@media print {
  /* Hide interactive elements */
  .sidebar,
  .nav,
  .no-print,
  button,
  .toast-container,
  .ai-chat,
  input,
  select,
  textarea,
  [role="tablist"] {
    display: none !important;
  }

  /* Full width content */
  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
    padding: 0 !important;
  }

  /* Clean typography */
  body {
    font-size: 11pt;
    color: #000;
    background: #fff;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* Remove shadows and unnecessary decoration */
  * {
    box-shadow: none !important;
    text-shadow: none !important;
  }

  /* Ensure links are readable */
  a {
    color: #000;
    text-decoration: underline;
  }

  /* Page breaks between categories */
  .category-section {
    page-break-before: always;
  }

  .category-section:first-child {
    page-break-before: avoid;
  }

  /* Entry formatting */
  .entry-card {
    border: 1px solid #ccc;
    padding: 12pt;
    margin-bottom: 12pt;
    page-break-inside: avoid;
  }

  /* Table of contents */
  .toc-section {
    page-break-after: always;
  }

  /* Header on every page */
  .print-header {
    position: running(header);
    background: #fff !important;
    color: #000 !important;
    border-bottom: 2px solid #333;
    padding-bottom: 8pt;
    margin-bottom: 12pt;
  }

  @page {
    margin: 1in;
    @top-center {
      content: element(header);
    }
  }

  /* Print break helper */
  .print-break {
    page-break-before: always;
  }

  /* Markdown content in print */
  .markdown-body {
    font-size: 10pt;
    color: #000;
  }

  .markdown-body h1 {
    font-size: 14pt;
    border-bottom: 1px solid #ccc;
    padding-bottom: 4pt;
  }

  .markdown-body h2 {
    font-size: 12pt;
  }

  .markdown-body h3 {
    font-size: 11pt;
  }

  .markdown-body pre {
    background: #f5f5f5 !important;
    color: #000 !important;
    border: 1px solid #ccc;
    padding: 8pt;
    font-size: 9pt;
    white-space: pre-wrap;
    word-wrap: break-word;
  }

  .markdown-body code {
    background: #f0f0f0;
    padding: 1pt 3pt;
    font-size: 9pt;
  }

  .markdown-body blockquote {
    border-left: 2pt solid #999;
    color: #333;
    padding-left: 8pt;
  }

  .markdown-body table {
    border-collapse: collapse;
    width: 100%;
  }

  .markdown-body th,
  .markdown-body td {
    border: 1px solid #999;
    padding: 4pt 6pt;
    font-size: 9pt;
  }

  .markdown-body th {
    background: #f0f0f0 !important;
    font-weight: bold;
  }

  /* Badge styling for print */
  .badge {
    border: 1px solid #999;
    padding: 1pt 4pt;
    font-size: 8pt;
  }

  /* OPSEC footer */
  .opsec-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 8pt;
    color: #666;
    border-top: 1px solid #ccc;
    padding-top: 4pt;
  }

  /* Ensure images don't overflow */
  img {
    max-width: 100% !important;
    page-break-inside: avoid;
  }

  /* Avoid orphans and widows */
  p, li {
    orphans: 3;
    widows: 3;
  }

  h2, h3 {
    page-break-after: avoid;
  }
}
