@media print {
  /* ── Page setup ───────────────────────────────────────────────── */
  @page {
    size: A4 portrait;
    margin: 20mm 18mm 25mm 18mm;
  }

  /*
   * Corporate palette derived from the "silk" DaisyUI theme:
   *   primary       oklch(23.27% 0.0249 284.3)  ≈ #2d2b39  (dark navy)
   *   base-content  oklch(40%    0.0081 61.42)   ≈ #5c5850  (warm charcoal)
   *   base-200      oklch(95%    0.0081 61.42)   ≈ #f0ede6  (warm ivory)
   *   base-300      oklch(90%    0.0081 61.42)   ≈ #e0dbd1  (warm sand)
   */

  /* ── Global reset for print ───────────────────────────────────── */
  *,
  *::before,
  *::after {
    box-shadow: none !important;
    text-shadow: none !important;
  }

  html {
    font-size: 11pt;
  }

  body {
    font-family: "Georgia", "Times New Roman", serif;
    line-height: 1.5;
    color: #5c5850 !important;
    background: #fff !important;
    orphans: 3;
    widows: 3;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* ── Typography ───────────────────────────────────────────────── */
  h1, h2, h3, h4, h5, h6 {
    font-family: "Helvetica Neue", "Arial", sans-serif;
    color: #2d2b39 !important;
    page-break-after: avoid;
    break-after: avoid;
    orphans: 3;
    widows: 3;
  }

  h1 {
    font-size: 20pt;
    margin: 0 0 8pt;
    border-bottom: 2pt solid #2d2b39;
    padding-bottom: 6pt;
  }

  h2 {
    font-size: 16pt;
    margin: 18pt 0 6pt;
    border-bottom: 0.75pt solid #e0dbd1;
    padding-bottom: 3pt;
  }

  h3 { font-size: 13pt; margin: 14pt 0 4pt; }
  h4 { font-size: 11pt; margin: 10pt 0 3pt; font-weight: 600; }

  p {
    margin: 0 0 6pt;
    color: #5c5850 !important;
  }

  strong, b {
    color: #2d2b39 !important;
  }

  /* ── Links ────────────────────────────────────────────────────── */
  a,
  a:visited {
    text-decoration: underline;
    color: #2d2b39 !important;
  }

  a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 8pt;
    font-weight: normal;
    color: #8a8580 !important;
    word-break: break-all;
  }

  a[href^="#"]::after,
  a[href^="javascript"]::after {
    content: "";
  }

  /* ── Images ───────────────────────────────────────────────────── */
  img {
    max-width: 100% !important;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  figure {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  /* ── Tables ───────────────────────────────────────────────────── */
  table {
    width: 100%;
    border-collapse: collapse;
    font-size: 9pt;
    page-break-inside: auto;
  }

  thead {
    display: table-header-group;
  }

  tr {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  th,
  td {
    border: 0.5pt solid #e0dbd1;
    padding: 4pt 6pt;
    text-align: left;
    vertical-align: top;
    color: #5c5850 !important;
  }

  th {
    font-weight: 700;
    background: #f0ede6 !important;
    color: #2d2b39 !important;
    border-bottom: 1pt solid #2d2b39;
  }

  tbody tr:nth-child(even) td {
    background: #f8f7f4 !important;
  }

  /* ── Cards & containers ───────────────────────────────────────── */
  .card {
    border: 0.5pt solid #e0dbd1;
    padding: 8pt;
    margin-bottom: 10pt;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  /* ── Lists ────────────────────────────────────────────────────── */
  ul, ol {
    margin: 0 0 6pt 14pt;
    padding: 0;
    color: #5c5850 !important;
  }

  li {
    margin-bottom: 2pt;
  }

  /* ── Code / preformatted ──────────────────────────────────────── */
  pre, code {
    font-family: "Courier New", monospace;
    font-size: 9pt;
    border: 0.5pt solid #e0dbd1;
    padding: 1pt 3pt;
    color: #5c5850 !important;
    background: #f8f7f4 !important;
  }

  pre {
    padding: 6pt;
    white-space: pre-wrap;
    word-wrap: break-word;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  /* ── Badges / tags ────────────────────────────────────────────── */
  .badge {
    border: 0.5pt solid #e0dbd1;
    padding: 1pt 4pt;
    font-size: 8pt;
    background: #f0ede6 !important;
    color: #2d2b39 !important;
  }

  /* ── Stats / metrics ──────────────────────────────────────────── */
  .stat {
    border: 0.5pt solid #e0dbd1;
    padding: 6pt 8pt;
    break-inside: avoid;
  }

  .stat-title {
    font-size: 8pt;
    text-transform: uppercase;
    letter-spacing: 0.5pt;
    color: #8a8580 !important;
  }

  .stat-value {
    font-size: 16pt;
    font-weight: 700;
    color: #2d2b39 !important;
  }

  /* ── Section titles ───────────────────────────────────────────── */
  .section-title {
    position: static !important;
    background: transparent !important;
    border-bottom: 0.75pt solid #e0dbd1;
    padding-bottom: 3pt;
    color: #2d2b39 !important;
  }

  /* ── Hide non-print UI chrome ─────────────────────────────────── */
  .drawer-side,
  .drawer-toggle,
  .navbar,
  .sidebar,
  nav,
  .btn,
  button,
  .flash,
  .alert,
  .toast,
  .modal,
  .dropdown,
  .tooltip,
  footer,
  .no-print,
  [data-turbo-permanent],
  [data-controller="posthog"] {
    display: none !important;
  }

  /* ── Layout normalization ─────────────────────────────────────── */
  .drawer,
  .drawer-content {
    display: block !important;
    overflow: visible !important;
    position: static !important;
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .container,
  .max-w-screen-xl,
  .max-w-7xl {
    max-width: 100% !important;
    padding: 0 !important;
  }

  /* ── Page break utilities ─────────────────────────────────────── */
  .page-break-before {
    page-break-before: always;
    break-before: page;
  }

  .page-break-after {
    page-break-after: always;
    break-after: page;
  }

  .avoid-break {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  /* ── Utility ──────────────────────────────────────────────────── */
  .print-only {
    display: block !important;
  }
}

/* Hidden on screen, visible in print */
.print-only {
  display: none;
}
