/* Print a worklist (PANEL-50 Wave 8, item 68).
 *
 * Presentation only. A queue/worklist page opts in with ONE class
 * on the element that wraps its rows:
 *
 *   <div class="print-worklist"> ...rows... </div>
 *
 * plus the print button partial (templates/_print_button.html),
 * which renders screen-side only. The shells link this file AFTER
 * style.css / the pp_base inline styles (see INTEGRATION NOTES in
 * the wave report; base.html and pp_base.html are not edited by
 * this cluster).
 *
 * LAW for this file: the printed page is a PAPER CHECKLIST ONLY —
 * no nav, no buttons, no form controls, no interactive chrome of
 * any kind. Everything interactive is display:none under @media
 * print, and the rows that carry data-queue-row render with one
 * empty tick box each so the list can be worked on paper.
 *
 * ORDER HONESTY: CSS cannot reorder rows. This file prints a list
 * in exactly the order the server rendered it. A list that is not
 * already oldest-first on screen does not become oldest-first on
 * paper; the wave report states each wired list's real order.
 *
 * On screen this file does exactly one thing: it keeps the
 * print-only meta line (page title + printed date, rendered by
 * _print_button.html) hidden. Every other rule lives inside the
 * @media print block below.
 */

/* Screen: the printed-date line belongs to paper only. */
.esc-print-meta { display: none; }

@media print {
  @page { margin: 14mm 12mm; }

  /* ---- paper basics: black on white, no shell geometry ------- */
  html, body {
    background: #fff !important;
    color: #000 !important;
    font-size: 11pt;
  }
  .layout { display: block !important; }
  .mainwrap { display: block !important; min-width: 0 !important; }
  main, .pp-main {
    max-width: none !important;
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  .card, .pp-card {
    background: #fff !important;
    border: none !important;
    box-shadow: none !important;
    animation: none !important;
    padding: 0 !important;
    margin: 0 0 10pt !important;
  }
  a { color: #000 !important; text-decoration: none !important; }
  .muted, .pp-muted { color: #333 !important; }
  .badge {
    background: #fff !important;
    border: 1pt solid #000 !important;
    color: #000 !important;
  }

  /* ---- chrome: NO nav, NO userbox, NO buttons, NO controls --- */
  .sidebar,
  .side-nav,
  nav,
  .pp-nav,
  header,
  .topbar,
  .userbox,
  .pp-head .who,
  .pp-banner,
  footer,
  .pager,
  .no-print,
  .esc-print-btn-wrap,
  #queue-keys-overlay,
  .esc-drafts-bar,
  .esc-drafts-status {
    display: none !important;
  }
  /* Every interactive control, everywhere on the page and inside
     the worklist scope in particular: buttons, form fields, and
     the claim/snooze widgets that ride inside queue rows. The
     <form> elements themselves are NOT hidden — in
     submissions.html the checklist table lives inside the bulk
     form, and hiding the form would hide the work. */
  button,
  .btn,
  input,
  select,
  textarea,
  .queue-claim,
  .queue-snooze {
    display: none !important;
  }
  form { display: block !important; margin: 0 !important; padding: 0 !important; }

  /* The paper page is the checklist ONLY: inside the desk shell's
     <main>, everything that is not the page title, the printed
     date line, or the .print-worklist scope itself stays off the
     paper (intro lines, the keyboard-keys overlay, pagers, bulk
     toolbars outside the scope, empty-state cards, footers). */
  main > *:not(.print-worklist):not(h1):not(.esc-print-meta) {
    display: none !important;
  }

  /* ---- the printed header line: title + printed date --------- */
  .esc-print-meta {
    display: block !important;
    font-size: 10pt;
    color: #333 !important;
    border-bottom: 1.5pt solid #000;
    padding-bottom: 4pt;
    margin: 0 0 10pt;
  }
  .print-worklist h1, main h1 {
    font-size: 16pt;
    margin: 0 0 6pt;
    color: #000 !important;
  }

  /* ---- the checklist itself ---------------------------------- */
  /* Table rows: keep the row, drop the screen hover/transition,
     and never split a row across pages. */
  .print-worklist table { width: 100%; border-collapse: collapse; }
  .print-worklist th, .print-worklist td {
    border-bottom: 0.75pt solid #999 !important;
    padding: 4pt 6pt;
    color: #000 !important;
    background: #fff !important;
    text-align: left;
  }
  .print-worklist tr { page-break-inside: avoid; }
  .print-worklist .card, .print-worklist .mirror-row {
    page-break-inside: avoid;
    border-bottom: 0.75pt solid #999 !important;
    padding: 4pt 0 8pt 22pt !important;
    position: relative;
  }

  /* One EMPTY TICK BOX per row — the paper half of the checklist.
     - card/div rows (mirror worklist): a box at the row's left.
     - table rows (submissions): the box sits in the first cell,
       where the screen checkbox (hidden above) used to be. */
  .print-worklist [data-queue-row]::before {
    content: "";
    display: inline-block;
    width: 11pt;
    height: 11pt;
    border: 1.5pt solid #000;
    background: #fff;
    margin-right: 8pt;
    vertical-align: baseline;
  }
  .print-worklist .card[data-queue-row]::before,
  .print-worklist .mirror-row[data-queue-row]::before {
    position: absolute;
    left: 0;
    top: 6pt;
    margin-right: 0;
  }
  .print-worklist tr[data-queue-row]::before {
    content: none;
    display: none;
  }
  .print-worklist tr[data-queue-row] > td:first-child::before {
    content: "";
    display: inline-block;
    width: 11pt;
    height: 11pt;
    border: 1.5pt solid #000;
    background: #fff;
  }

  /* Snoozed rows collapse to a one-line entry on screen; on paper
     they are still worklist rows and keep their tick box. */
  .print-worklist .snoozed-row { opacity: 1 !important; }
}
