/* Spark Agency HR — printing layout (v36). Works with print.js.
   Only #print-root is printed; paper size comes from print-<paper>.css. */

#print-root {
  display: none;
}
.print-paper-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.print-paper-control select {
  width: auto;
  min-width: 170px;
  margin: 0;
}

@media print {
  html,
  body.is-printing {
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
    min-height: 0 !important;
    height: auto !important;
    overflow: visible !important;
    display: block !important;
  }
  /* Remove everything except the copy. display:none takes no space,
     so there are no trailing blank pages. */
  body.is-printing > *:not(#print-root),
  body.is-printing dialog,
  body.is-printing dialog#voucher-dialog,
  body.is-printing dialog#document-dialog,
  body.is-printing .login-ambient,
  body.is-printing #notice {
    display: none !important;
  }
  body.is-printing::before,
  body.is-printing::after {
    display: none !important;
  }
  body.is-printing #print-root,
  body.is-printing #print-root * {
    visibility: visible !important;
    animation: none !important;
    transition: none !important;
    box-shadow: none !important;
  }
  body.is-printing #print-root {
    display: block !important;
    position: static !important;
    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    color: #111 !important;
    background: #fff !important;
    font-family: "Manrope", "IBM Plex Sans Arabic", "Segoe UI", Arial, sans-serif;
    font-size: 10pt;
    line-height: 1.45;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  #print-root > * {
    position: static !important;
    width: auto !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    overflow: visible !important;
  }
  #print-root img {
    max-width: 100%;
  }
  #print-root table {
    width: 100% !important;
    border-collapse: collapse;
    break-inside: auto;
    font-variant-numeric: tabular-nums;
  }
  #print-root thead {
    display: table-header-group;
  }
  #print-root tr {
    break-inside: avoid;
  }
  #print-root th,
  #print-root td {
    position: static !important;
    white-space: normal !important;
    overflow-wrap: anywhere;
    text-transform: none;
    letter-spacing: 0;
  }
  #print-root h1,
  #print-root h2,
  #print-root h3 {
    break-after: avoid;
    color: inherit;
  }
  #print-root .signatures,
  #print-root .profile-print-head,
  #print-root .profile-print-signatures,
  #print-root .salary-change-banner {
    break-inside: avoid;
  }

  /* ---------- Salary voucher ---------- */
  .print-voucher #voucher {
    padding: 0 !important;
    color: #344d91;
  }
  .print-voucher #voucher .sheet {
    margin: 0 !important;
    padding: 7mm !important;
    border: 1.5pt solid #344d91;
    border-radius: 3mm;
    break-inside: avoid;
  }
  /* A4 / Letter: employee + office copy share one sheet when they fit,
     separated by a cut line. A5 starts each copy on a new page. */
  .print-voucher #voucher .sheet + .sheet {
    margin-top: 9mm !important;
    position: relative;
  }
  .print-voucher #voucher .sheet + .sheet::before {
    content: "";
    position: absolute;
    left: -2mm;
    right: -2mm;
    top: -5.5mm;
    border-top: 0.8pt dashed #8f9cc4;
  }
  #print-root.paper-a5 #voucher .sheet + .sheet {
    break-before: page;
    margin-top: 0 !important;
  }
  #print-root.paper-a5 #voucher .sheet + .sheet::before {
    display: none;
  }
  .print-voucher #voucher p {
    margin: 1.6mm 0;
  }
  .print-voucher #voucher header {
    margin-bottom: 4mm;
    padding-bottom: 3mm;
    line-height: 1.5;
  }
  .print-voucher #voucher img {
    width: 48mm;
    max-height: 24mm;
    object-fit: contain;
  }
  .print-voucher #voucher h2 {
    font-size: 15pt;
    margin: 3mm 0;
  }
  .print-voucher #voucher table {
    font-size: 9pt;
    margin: 2mm 0;
  }
  .print-voucher #voucher td,
  .print-voucher #voucher th {
    padding: 1.6mm 2mm;
    border-bottom: 0.5pt solid #c9d1e8;
    color: #344d91;
    text-align: left;
    vertical-align: top;
  }
  .print-voucher #voucher th {
    font-size: 8pt;
    font-weight: 700;
  }
  .print-voucher #voucher details > summary {
    list-style: none;
    font-weight: 700;
    margin: 3mm 0 1mm;
  }
  .print-voucher #voucher details > summary::-webkit-details-marker {
    display: none;
  }
  /* Employee information in two columns */
  .print-voucher #voucher table.info-grid,
  .print-voucher #voucher table.info-grid tbody {
    display: block;
  }
  .print-voucher #voucher table.info-grid tbody {
    column-count: 2;
    column-gap: 6mm;
  }
  .print-voucher #voucher table.info-grid tr {
    display: flex;
    break-inside: avoid;
    border-bottom: 0.5pt solid #c9d1e8;
  }
  .print-voucher #voucher table.info-grid td {
    border: 0;
    flex: 1 1 50%;
    padding: 1mm 1.5mm;
  }
  .print-voucher #voucher table.info-grid td:first-child {
    opacity: 0.8;
  }
  #print-root.paper-receipt #voucher table.info-grid tbody {
    column-count: 1;
  }
  .print-voucher #voucher .signatures {
    display: flex;
    justify-content: space-between;
    gap: 8mm;
    margin-top: 12mm;
    font-size: 9pt;
  }

  /* A5: same layout, tighter */
  #print-root.paper-a5 {
    font-size: 8.5pt;
  }
  #print-root.paper-a5 #voucher .sheet {
    padding: 5mm !important;
  }
  #print-root.paper-a5 #voucher img {
    width: 38mm;
    max-height: 18mm;
  }
  #print-root.paper-a5 #voucher h2 {
    font-size: 12.5pt;
  }
  #print-root.paper-a5 #voucher table {
    font-size: 7.5pt;
  }
  #print-root.paper-a5 #voucher td,
  #print-root.paper-a5 #voucher th {
    padding: 1.1mm 1.4mm;
  }
  #print-root.paper-a5 #voucher .signatures {
    margin-top: 6mm;
    font-size: 7.5pt;
  }
  #print-root.paper-a5 #voucher header {
    margin-bottom: 2mm;
    padding-bottom: 2mm;
    line-height: 1.35;
  }
  #print-root.paper-a5 #voucher h2 {
    margin: 1.5mm 0;
  }
  #print-root.paper-a5 #voucher p {
    margin: 1mm 0;
  }
  #print-root.paper-a5 #voucher table.info-grid td {
    padding: 0.6mm 1mm;
  }

  /* Receipt 80 mm: single column, no frame */
  #print-root.paper-receipt {
    font-size: 8pt;
    line-height: 1.35;
  }
  #print-root.paper-receipt #voucher .sheet {
    border: 0;
    border-radius: 0;
    padding: 0 !important;
  }
  #print-root.paper-receipt #voucher .sheet + .sheet {
    border-top: 1pt dashed #344d91;
    padding-top: 4mm !important;
  }
  #print-root.paper-receipt #voucher header {
    display: block !important;
    text-align: center;
  }
  #print-root.paper-receipt #voucher header > * {
    display: block;
    width: auto !important;
    text-align: center;
  }
  #print-root.paper-receipt #voucher img {
    width: 36mm;
    max-height: 16mm;
    margin: 2mm auto 0;
  }
  #print-root.paper-receipt #voucher h2 {
    font-size: 11pt;
  }
  #print-root.paper-receipt #voucher table {
    font-size: 7pt;
    table-layout: fixed;
  }
  #print-root.paper-receipt #voucher td,
  #print-root.paper-receipt #voucher th {
    padding: 0.8mm 0.6mm;
    font-size: 7pt;
  }
  #print-root.paper-receipt #voucher .signatures {
    display: block;
    margin-top: 6mm;
  }
  #print-root.paper-receipt #voucher .signatures > * {
    display: block;
    margin: 0 0 7mm;
  }

  /* ---------- Documents & reports ---------- */
  .print-document #document-content,
  .print-report #report-content {
    padding: 0 !important;
    line-height: 1.5;
    color: #111;
  }
  .print-document #document-content h1,
  .print-report #report-content h1 {
    font-size: 17pt;
    margin: 0 0 3mm;
  }
  .print-document #document-content h2,
  .print-report #report-content h2 {
    font-size: 13pt;
    margin: 5mm 0 2mm;
  }
  .print-document #document-content h3,
  .print-report #report-content h3 {
    font-size: 11pt;
    margin: 4mm 0 2mm;
  }
  .print-document table,
  .print-report table {
    font-size: 8.5pt !important;
    margin: 2mm 0 4mm;
  }
  .print-document th,
  .print-report th {
    background: #eef3f2 !important;
    color: #0f2a36 !important;
    font-weight: 700;
    text-align: left;
    border-bottom: 0.8pt solid #9fb4b1;
    padding: 1.6mm 2mm !important;
  }
  .print-document td,
  .print-report td {
    border-bottom: 0.5pt solid #d5dfdd;
    padding: 1.4mm 2mm !important;
    vertical-align: top;
  }
  .print-report .panel,
  .print-document .panel,
  .print-document .office-card {
    border: 0.6pt solid #cfdad8 !important;
    border-radius: 2mm !important;
    padding: 4mm 5mm !important;
    margin: 0 0 4mm !important;
    background: #fff !important;
    break-inside: auto;
  }
  .print-report .scroll,
  .print-document .scroll {
    overflow: visible !important;
    border: 0 !important;
    background: none !important;
  }
  .print-document #document-content .signatures,
  .print-document .profile-print-signatures {
    margin-top: 16mm;
    display: flex;
    justify-content: space-between;
    gap: 10mm;
  }
  #print-root.paper-a5 table {
    font-size: 7.5pt !important;
  }
  #print-root.paper-a5 h1 {
    font-size: 14pt !important;
  }
}
