/* ==========================================================================
   OTO Training Library — print rules for the customer help centres
   Shared by every module. Cheat sheets are matched by their heading id
   suffix, so a new sheet needs no stylesheet change.
   ========================================================================== */

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

  .md-banner,
  .md-header,
  .md-tabs,
  .md-sidebar,
  .md-footer,
  .md-content__button,
  .md-top {
    display: none !important;
  }

  .md-main__inner,
  .md-content,
  .md-content__inner {
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
  }

  .md-typeset {
    font-size: 9.5pt;
    line-height: 1.25;
  }

  .md-typeset h1 {
    margin: 0 0 4mm;
    padding: 4mm 5mm 3.5mm;
    border-bottom: 1.5mm solid #22a6a1;
    border-radius: 2mm 2mm 0 0;
    background: #17324d;
    color: #fff;
    font-size: 18pt;
    font-weight: 700;
    letter-spacing: -0.2pt;
  }

  .md-typeset h2 {
    margin: 2.6mm 0 1.8mm;
    padding: 1.2mm 2.2mm;
    border-bottom: 0;
    border-left: 1.2mm solid #22a6a1;
    background: #edf6f6;
    color: #17324d;
    font-size: 11pt;
    font-weight: 700;
    line-height: 1.15;
  }

  .md-typeset h3 {
    margin: 2mm 0 0.8mm;
    padding-left: 0;
    color: #17324d;
    font-size: 9.5pt;
    font-weight: 700;
  }

  /* The teal tick and step markers are screen devices; print keeps the
     ordinary numbering so a photocopied page still reads correctly. */
  .md-typeset h3::before,
  .md-typeset > ol > li::before,
  .md-typeset > ol > li::after,
  .md-typeset .steps ol > li::before,
  .md-typeset .steps ol > li::after {
    display: none;
  }

  .md-typeset > ol,
  .md-typeset .steps ol {
    padding-left: 1.4em;
    list-style: decimal;
  }

  /* The generous spacing that separates steps on screen would cost a cheat
     sheet a whole page in print. */
  .md-typeset > ol > li,
  .md-typeset .steps ol > li {
    margin-bottom: 0;
    padding-left: 0;
  }

  /* Material puts every table inside a scrolling block wrapper, which in print
     clips the table, stops the header repeating, and — with break-inside on the
     table itself — pushes each table onto a page of its own. Restore real table
     layout so a long table simply flows, repeating its header. */
  .md-typeset__scrollwrap,
  .md-typeset__table {
    display: block;
    overflow: visible !important;
  }

  .md-typeset table:not([class]) {
    display: table !important;
    width: 100%;
    border-radius: 0;
    font-size: 8.5pt;
    table-layout: auto;
  }

  .md-typeset table:not([class]) thead {
    display: table-header-group;
  }

  .md-typeset table:not([class]) th {
    position: static;
    background-color: #edf6f6;
    font-size: 7.5pt;
  }

  .md-typeset table:not([class]) th,
  .md-typeset table:not([class]) td {
    padding: 1mm 1.6mm;
    white-space: normal;
  }

  .md-typeset table:not([class]) tr,
  .md-typeset li,
  .md-typeset img {
    break-inside: avoid;
  }

  .md-typeset img {
    max-height: 110mm;
    box-shadow: none;
  }

  /* ---------------------------------------------------------- cheat sheets */

  .md-content__inner.md-typeset:has([id$="-cheat-sheet"]) {
    padding-bottom: 8mm !important;
    color: #17212b;
    font-size: 9pt;
    line-height: 1.18;
  }

  .md-content__inner.md-typeset:has([id$="-cheat-sheet"]) h2 {
    font-size: 10.5pt;
  }

  .md-content__inner.md-typeset:has([id$="-cheat-sheet"]) p,
  .md-content__inner.md-typeset:has([id$="-cheat-sheet"]) ul,
  .md-content__inner.md-typeset:has([id$="-cheat-sheet"]) ol {
    margin-top: 0.7mm;
    margin-bottom: 1.4mm;
  }

  .md-content__inner.md-typeset:has([id$="-cheat-sheet"]) li {
    margin-bottom: 0.65mm;
    padding-left: 0.5mm;
  }

  .md-content__inner.md-typeset:has([id$="-cheat-sheet"]) strong {
    color: #102b45;
    font-weight: 700;
  }

  /* The POS cashier sheet carries the most content of any sheet and needs
     tighter type to hold a single page. 8.5pt is the largest that still fits;
     if the sheet grows again, cut content rather than shrinking this further. */
  .md-content__inner.md-typeset:has(#oto-pos-cashier-cheat-sheet) {
    font-size: 8.5pt;
    line-height: 1.1;
  }

  .md-content__inner.md-typeset:has(#oto-pos-cashier-cheat-sheet) h1 {
    margin-bottom: 2.5mm;
    padding-top: 3mm;
    padding-bottom: 2.8mm;
    font-size: 16.5pt;
  }

  .md-content__inner.md-typeset:has(#oto-pos-cashier-cheat-sheet) h2 {
    margin-top: 1mm;
    margin-bottom: 1.2mm;
    padding-top: 0.8mm;
    padding-bottom: 0.8mm;
    font-size: 10pt;
  }

  .md-content__inner.md-typeset:has(#oto-pos-cashier-cheat-sheet) p,
  .md-content__inner.md-typeset:has(#oto-pos-cashier-cheat-sheet) ul,
  .md-content__inner.md-typeset:has(#oto-pos-cashier-cheat-sheet) ol {
    margin-top: 0.4mm;
    margin-bottom: 0.8mm;
  }

  .md-content__inner.md-typeset:has(#oto-pos-cashier-cheat-sheet) li {
    margin-bottom: 0.3mm;
  }

  .md-content__inner.md-typeset:has([id$="-cheat-sheet"])::after {
    position: fixed;
    right: 10mm;
    bottom: 3mm;
    left: 10mm;
    padding-top: 1.8mm;
    border-top: 0.35mm solid #22a6a1;
    color: #405261;
    content: "Website → www.oto.rw  |  Kapp MicroSystems – OTO Software";
    font-size: 7.5pt;
    font-weight: 600;
    letter-spacing: 0.1pt;
    text-align: center;
  }
}
