/* ==========================================================================
   Print — a branded one-page logic model. Drives "Save as PDF" too.
   The printable sheet is built into the DOM (#printSheet) and is the ONLY
   thing that prints; the app chrome is hidden entirely.
   ========================================================================== */
#printSheet { display: none; }

@media print {
  @page { size: A4 landscape; margin: 12mm; }

  /* Paper is always light. The dark-theme selector carries higher specificity
     than a bare :root, so it must be named here or a user printing in dark
     mode gets near-white headings on white paper. */
  :root, :root[data-theme="dark"] {
    --ink: #0e2140; --ink-soft: #44587a; --ink-faint: #8698b3;
    --line: #c9d8ea; --line-strong: #c9d8ea;
    --surface: #fff; --surface-2: #f2f6fb; --bg: #fff;
    color-scheme: light;
  }
  html, body { background: #fff !important; color: #000; }

  .shell, .toast, .modal-layer, .tour-veil, .tour-spot, .tour-pop,
  .mobile-nav, .skip-link { display: none !important; }

  #printSheet {
    display: block !important;
    font-family: var(--font-body);
    color: #0e2140;
  }

  .ps-head {
    display: flex; align-items: center; gap: 10mm;
    padding-bottom: 4mm; margin-bottom: 6mm;
    border-bottom: 2px solid #153f7d;
  }
  .ps-head .logo-mark { width: 20mm; height: 20mm; flex: none; }
  .ps-title { flex: 1; min-width: 0; }
  .ps-title h1 { font-size: 20pt; letter-spacing: -.02em; margin-bottom: 1.5mm; }
  .ps-title .ps-sub { font-size: 9pt; color: #44587a; }
  .ps-brand { text-align: right; font-size: 8pt; color: #44587a; line-height: 1.45; }
  .ps-brand b { display: block; font-family: var(--font-head); font-size: 10pt; color: #153f7d; }

  .ps-meta {
    display: grid; grid-template-columns: repeat(4, 1fr);
    gap: 4mm; margin-bottom: 6mm;
  }
  .ps-meta div { font-size: 8.5pt; }
  .ps-meta b {
    display: block; font-size: 7pt; text-transform: uppercase;
    letter-spacing: .09em; color: #44587a; margin-bottom: 1mm;
  }

  .ps-problem {
    padding: 3.5mm 4mm; margin-bottom: 6mm;
    background: #f2f6fb; border-left: 1.2mm solid #153f7d;
    font-size: 9pt;
  }
  .ps-problem b { display: block; font-size: 7pt; text-transform: uppercase; letter-spacing: .09em; color: #44587a; margin-bottom: 1mm; }

  /* The four levels, printed as the same left-to-right chain as on screen */
  .ps-chain { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4mm; }
  .ps-col { break-inside: avoid; }
  .ps-col-head {
    display: flex; align-items: center; gap: 2mm;
    padding-bottom: 1.5mm; margin-bottom: 2.5mm;
    border-bottom: .8mm solid var(--c);
    font-family: var(--font-head); font-size: 9pt; font-weight: 600;
  }
  /* Beside its own label, not flushed to the column edge — see the note in
     views.css: a right-flushed count reads as the next column's. */
  .ps-col-head .n {
    padding: 0 1.6mm; border-radius: 2mm;
    background: #f2f6fb; font-size: 7.5pt; color: #44587a;
  }
  .ps-item {
    padding: 2.5mm 3mm; margin-bottom: 2mm;
    border: .25mm solid #c9d8ea; border-left: .9mm solid var(--c);
    border-radius: 1.5mm;
    font-size: 8.5pt; line-height: 1.4;
    break-inside: avoid;
  }
  .ps-item .ps-n { font-size: 7pt; color: #44587a; font-weight: 700; }
  .ps-empty { font-size: 8pt; color: #8698b3; font-style: italic; }

  .ps-assume { margin-top: 6mm; break-inside: avoid; }

  /* ---- Logframe matrix ---------------------------------------------------
     Shares the sheet's head, meta band and footer; only the table is new. */
  .lf-table {
    width: 100%; border-collapse: collapse; margin-top: 4mm;
    font-size: 8.5pt; table-layout: fixed;
  }
  .lf-table thead th {
    text-align: left; font-family: var(--font-head); font-size: 7pt;
    text-transform: uppercase; letter-spacing: .09em; color: #44587a;
    padding: 0 2mm 1.5mm; border-bottom: .5pt solid #c9d8ea;
  }
  .lf-table th.lf-rank { width: 24mm; }
  .lf-table col, .lf-table td { vertical-align: top; }
  .lf-table tbody th, .lf-table tbody td {
    padding: 2.5mm 2mm; border-bottom: .5pt solid #e4edf7; break-inside: avoid;
  }
  .lf-table tbody th.lf-rank {
    text-align: left; border-left: 1.2pt solid var(--c);
    padding-left: 2.5mm;
  }
  .lf-table tbody th.lf-rank b {
    display: block; font-family: var(--font-head); font-size: 9pt; color: #153f7d;
  }
  .lf-table tbody th.lf-rank span { font-size: 7.5pt; color: #44587a; }
  .lf-narr { width: 34%; }
  .lf-mov  { width: 15%; }
  .lf-assume { width: 22%; border-left: .5pt solid #c9d8ea; }
  .lf-list, .lf-ind { margin: 0; padding-left: 4.5mm; }
  .lf-list li, .lf-ind li { margin-bottom: 1.2mm; }
  .lf-list li::marker, .lf-ind li::marker { color: #8698b3; font-size: 7.5pt; }
  .lf-blank { color: #8698b3; }
  .lf-tag {
    font-style: normal; font-size: 6.5pt; color: #856300;
    background: #fdf3d6; padding: .2mm 1mm; border-radius: 1mm;
  }
  .lf-sub {
    font-size: 7pt; font-family: var(--font-head); color: #44587a;
    margin: 2.5mm 0 1mm;
  }
  .lf-note, .lf-foot-note {
    font-size: 7pt; color: #44587a; line-height: 1.45; margin-top: 2mm;
  }
  .lf-foot-note { margin-top: 3mm; }
  .ps-assume > b {
    display: block; font-family: var(--font-head); font-size: 9pt;
    padding-bottom: 1.5mm; margin-bottom: 2.5mm;
    border-bottom: .8mm solid #e21548;
  }
  .ps-assume ol { padding-left: 5mm; columns: 2; column-gap: 8mm; }
  .ps-assume li { font-size: 8.5pt; margin-bottom: 1.5mm; break-inside: avoid; }

  .ps-foot {
    margin-top: 8mm; padding-top: 3mm;
    border-top: .3mm solid #c9d8ea;
    display: flex; justify-content: space-between;
    font-size: 7.5pt; color: #44587a;
  }

  a[href]::after { content: ""; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; box-shadow: none !important; }
}
