/* Print layout — one landscape page, all browsers (in-page window.print) */
@media print {
  @page {
    size: 297mm 210mm;
    margin: 10mm;
  }

  html::before {
    display: none !important;
  }

  html, body {
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    background: #fff !important;
    background-image: none !important;
    color: #000 !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  body {
    display: block !important;
    position: static !important;
    inset: auto !important;
  }

  .no-print,
  .modal-overlay,
  .vacation-tip-toast,
  .day-info-toast {
    display: none !important;
  }

  .fms-bezel,
  .container {
    background: none !important;
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    width: auto !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    max-width: none !important;
    display: block !important;
    position: static !important;
    overflow: visible !important;
  }

  .print-area {
    width: 277mm;
    max-width: 277mm;
    overflow: hidden !important;
    page-break-inside: avoid !important;
    break-inside: avoid-page !important;
    display: block !important;
  }

  .print-only {
    display: block !important;
    font-size: 7pt;
    font-weight: 700;
    margin: 0 0 1mm 0;
    padding: 0;
    height: 4mm;
    line-height: 4mm;
    white-space: nowrap;
    overflow: hidden;
    color: #000 !important;
    page-break-after: avoid !important;
    break-after: avoid-page !important;
  }

  .gantt-panel,
  #gantt-container {
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
    width: 277mm !important;
    max-width: 277mm !important;
    min-height: 0 !important;
    background: #fff !important;
    display: block !important;
    page-break-before: avoid !important;
    break-before: avoid-page !important;
    page-break-inside: avoid !important;
    break-inside: avoid-page !important;
  }

  .gantt-table {
    width: 277mm !important;
    max-width: 277mm !important;
    table-layout: fixed !important;
    font-size: 6.8pt;
    border-collapse: collapse !important;
    page-break-inside: avoid !important;
    break-inside: avoid-page !important;
  }

  /* Safari repeats thead on every page unless row-group is forced */
  .gantt-table thead {
    display: table-row-group !important;
  }

  .gantt-table tbody {
    display: table-row-group !important;
  }

  .gantt-table tr {
    page-break-inside: avoid !important;
    break-inside: avoid-page !important;
  }

  .gantt-table thead tr {
    height: 5mm !important;
  }

  .gantt-table tbody tr {
    height: 13.4mm !important;
  }

  .gantt-table th,
  .gantt-table td {
    padding: 0 !important;
    border: 0.35pt solid #ccc !important;
    line-height: 1;
    overflow: hidden;
    vertical-align: middle !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  .gantt-month-label {
    width: 11mm !important;
    font-size: 6.5pt !important;
    font-weight: 700;
    background: #f2f2f2 !important;
    color: #000 !important;
  }

  .gantt-dow-head {
    font-size: 6.6pt !important;
    font-weight: 800 !important;
    background: #f5f5f5 !important;
    color: #000 !important;
  }

  .gantt-dow-head.gantt-sat-col,
  .gantt-dow-head.gantt-sun-col {
    background: #f5f5f5 !important;
    color: #000 !important;
  }

  .gantt-weekend-gap {
    width: 1.4mm !important;
    min-width: 1.4mm !important;
    max-width: 1.4mm !important;
    padding: 0 !important;
    border-top: 0.35pt solid #ccc !important;
    border-bottom: 0.35pt solid #ccc !important;
    border-left: 0 !important;
    border-right: 0 !important;
    background: #fff !important;
    position: relative !important;
  }

  thead .gantt-weekend-gap {
    background: #f5f5f5 !important;
  }

  .gantt-weekend-gap::before {
    content: '' !important;
    position: absolute !important;
    left: 50% !important;
    top: 0 !important;
    bottom: 0 !important;
    width: 0.75pt !important;
    margin-left: -0.375pt !important;
    background: #0078a8 !important;
  }

  .gantt-cell.gantt-sat-col.gantt-empty,
  .gantt-cell.gantt-sun-col.gantt-empty {
    background: #fff !important;
  }

  .gantt-empty {
    background: #fff !important;
  }

  /* Grayscale-friendly fills: light tints + dark text, not heavy mid-greys */
  .gantt-work {
    background: #e3eef6 !important;
    box-shadow: inset 0 0 0 0.35pt #666 !important;
  }

  .gantt-off {
    background: #fafafa !important;
  }

  .gantt-pt80 {
    background: #e8f4ea !important;
    box-shadow: inset 0 0 0 0.35pt #666 !important;
  }

  .gantt-unsupported {
    background: #f5f5f5 !important;
  }

  .day-num {
    font-size: 7.2pt !important;
    font-weight: 700 !important;
    color: #000 !important;
  }

  .gantt-cell.gantt-today::after {
    display: none !important;
    content: none !important;
  }

  .cycle-mark {
    font-size: 8.5pt !important;
    color: #000 !important;
    opacity: 1 !important;
    font-weight: 800;
  }

  .pt-mark {
    top: 1pt !important;
    left: 1pt !important;
    font-size: 5pt !important;
    color: #000 !important;
    font-weight: 800;
  }

  .holiday-mark {
    display: block !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    right: auto !important;
    transform: translate(-50%, calc(-50% - 6pt)) !important;
    font-size: 7.2pt !important;
    font-weight: 700 !important;
    color: #000 !important;
  }

  .gantt-vacation,
  .gantt-vacation.gantt-work,
  .gantt-vacation.gantt-off,
  .gantt-vacation.gantt-pt80,
  .gantt-vacation.gantt-work.gantt-sat-col,
  .gantt-vacation.gantt-work.gantt-sun-col,
  .gantt-vacation.gantt-off.gantt-sat-col,
  .gantt-vacation.gantt-off.gantt-sun-col,
  .gantt-vacation.gantt-pt80.gantt-sat-col,
  .gantt-vacation.gantt-pt80.gantt-sun-col {
    background: #d8d8d8 !important;
    background-image: none !important;
    box-shadow: inset 0 0 0 0.35pt #666 !important;
  }

  .vac-mark {
    display: block !important;
    position: absolute !important;
    top: 1pt !important;
    left: 0 !important;
    right: 0 !important;
    font-size: 5.5pt !important;
    color: #000 !important;
    font-weight: 800 !important;
    text-align: center !important;
    line-height: 1 !important;
  }

  .gantt-vacation-pending {
    outline: none !important;
  }
}

@media print and (prefers-color-scheme: dark) {
  body, .container, .gantt-panel, .gantt-table {
    background: #fff !important;
    color: #000 !important;
  }

  .day-num,
  .gantt-dow-head,
  .gantt-month-label,
  .cycle-mark,
  .pt-mark,
  .holiday-mark,
  .vac-mark,
  .print-only {
    color: #000 !important;
  }
}
