/* Print report styling. Screen rules live in styles.css; everything here is
   scoped to print. js/ui-print.js adds body.print-mode and fills #print-header
   before the dialog opens. */
@media print {

  /* Always print the light palette, whatever the OS theme is. */
  :root {
    color-scheme: light;
    --page:            #ffffff;
    --surface:         #ffffff;
    --ink:             #0b0b0b;
    --ink-secondary:   #52514e;
    --ink-muted:       #6e6c66;
    --grid:            #e1e0d9;
    --baseline:        #c3c2b7;
    --border:          rgba(11, 11, 11, 0.10);

    --series-1: #2a78d6;
    --series-2: #eb6834;
    --series-3: #1baf7a;
    --series-4: #eda100;
    --series-5: #e87ba4;

    /* Re-pin the tokens the dark theme overrides — the dark media query can
       match during printing, and these must stay print-light values. */
    --status-critical: #d03b3b;
    --success-text: #006300;
    --status-serious-text: #b3491a;
    --status-warning-text: #8a6400;
    --accent-text:         #1f66c2;
  }

  body { background: #fff; }

  /* Interactive chrome has no place on paper. The map is hidden too: its
     tiles are network-fetched and print blank — the locations table below it
     carries the same data. */
  .topbar-controls,
  #banner,
  #filter-bar,
  #map,
  .btn,
  #timeline-more,
  #sessions-more,
  #privileged-more,
  #insights-more,
  .reset-filters-link,
  #toasts,
  #drag-overlay { display: none !important; }

  .data-table th.sortable { text-decoration: none; }
  .data-table th.sortable::after { content: none; }

  .topbar { position: static; border-bottom: none; padding: 0 0 4px; }

  /* Report masthead (filled by ui-print.js). */
  .print-header { margin: 0 0 16px; padding-bottom: 12px; border-bottom: 2px solid #0b0b0b; }
  .print-header h1 { font-size: 18px; margin-bottom: 8px; }
  .print-header .print-meta { font-size: 12px; color: #52514e; display: grid; gap: 2px; }

  main { max-width: none; padding: 0; }

  /* Linearize the dashboard: one card after another, none split mid-page. */
  .grid { display: block; }
  .card {
    display: block;
    width: auto;
    margin: 0 0 14px;
    border: 1px solid #ccc;
    box-shadow: none;
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .card-sessions, .card-timeline {
    break-before: page;
    page-break-before: always;
    /* A >1-page table cannot also honor break-inside: avoid. */
    break-inside: auto;
    page-break-inside: auto;
  }

  /* Tables and the timeline print in full — no inner scrollbars. */
  .table-scroll { max-height: none; overflow: visible; }
  .timeline { max-height: none; overflow: visible; }

  .chart-wrap { height: 260px; }
  canvas { max-width: 100%; }

  a { color: inherit; text-decoration: none; }
}
