/*
 * Print styles. Loaded with media="print", so everything here only applies on paper.
 * Goal: drop the app chrome, print black-on-white, and make data tables read well and
 * repeat their header row across pages.
 */

@media print {
  @page {
    margin: 1.5cm;
  }

  body {
    background: #fff !important;
    color: #000 !important;
  }

  /* Hide all on-screen-only chrome and controls. */
  .site-header,
  .staging-banner,
  .crouton-container,
  #notice,
  #alert,
  .no-print,
  a[href^="javascript:print"] {
    display: none !important;
  }

  /* The on-screen content padding isn't needed once @page provides margins. */
  .px-3 {
    padding: 0 !important;
  }

  /* Links print as plain black text. */
  a,
  a:link,
  a:visited {
    color: #000;
    text-decoration: none;
  }

  /* --- Reports --- */

  .report-page {
    font-size: 12px;
    line-height: 1.35;
    color: #000;
  }

  .report-page h1 {
    font-size: 18px;
    margin: 0 0 0.5rem;
  }

  .report-page h2,
  .report-page h4 {
    font-size: 14px;
    margin: 0.5rem 0;
  }

  /* Scroll containers hide overflow on screen; let all report content show on paper. */
  .report-page,
  .report-page *,
  .report-table-container,
  .report-table-container * {
    overflow: visible !important;
  }

  .report-table {
    width: 100%;
    border-collapse: collapse;
    break-inside: auto;
    page-break-inside: auto;
    font-size: 12px;
  }

  /* Repeat the header row (and any footer) on every printed page. */
  .report-table thead {
    display: table-header-group;
  }

  .report-table tfoot {
    display: table-footer-group;
  }

  /* Keep individual rows/cells from splitting across a page break. */
  .report-table tr,
  .report-table th,
  .report-table td {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .report-table th,
  .report-table td {
    border: 1px solid #000;
    padding: 0.15rem 0.4rem;
  }

  /* Explicit page breaks (e.g. one client per page on monthly charts). */
  .page-break {
    page-break-after: always;
  }

  /* --- Client printout --- */

  /* Stack the two-column client layout into one full-width column, drop the
     on-screen card borders/backgrounds, and avoid splitting a section. */
  .client-print-body {
    display: block !important;
  }

  .client-print-body > div {
    max-width: none !important;
    width: 100% !important;
    margin: 0 0 0.75rem !important;
    padding: 0 !important;
    break-inside: avoid;
  }

  /* Drop the on-screen card chrome (gray panels, borders, shadows, rings). */
  .client-print-body [class*="bg-gray"],
  .client-print-body [class*="rounded"],
  .client-print-body [class*="shadow"],
  .client-print-body [class*="ring-"],
  .client-print-body [class*="border"] {
    background: transparent !important;
    box-shadow: none !important;
    border-color: transparent !important;
  }

  /* No action buttons/links belong on an informational printout. */
  .client-print .btn-primary,
  .client-print button,
  .client-print input,
  .client-print select {
    display: none !important;
  }
}
