/* Ctrl+P: print the active workspace tab only (see Printing/printElement.js). */

.task-manager-print-host,
.gantt-print-raster-host {
  display: none;
}

@page portrait-sheet {
  size: A4 portrait;
  margin: 12mm;
}

@page landscape-sheet {
  size: A4 landscape;
  margin: 10mm;
}

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

  body[data-print-view="schedule"],
  body[data-print-view="organisation"],
  body[data-print-view="cost"] {
    page: portrait-sheet;
  }

  body[data-print-view="gantt"],
  body[data-print-view="board"],
  body[data-print-view="task-manager"] {
    page: landscape-sheet;
  }

  #gantt-tooltip,
  .app-header,
  .dashboard-sidebar {
    display: none !important;
  }

  .app-shell {
    padding: 0 !important;
    max-width: none !important;
  }

  .dashboard-layout {
    display: block !important;
  }

  .dashboard-main,
  .workspace-view,
  .workspace-window {
    min-width: 0 !important;
    width: 100% !important;
  }

  .workspace-view[hidden] {
    display: none !important;
  }

  .workspace-view.view-panel-active {
    display: block !important;
  }

  .surface-card,
  .surface-panel,
  .workspace-window {
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: #fff !important;
  }

  .surface-panel {
    padding: 0 !important;
  }

  .print-fit-host {
    margin: 0 auto !important;
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .workspace-header {
    display: block !important;
    margin: 0 0 6mm !important;
    padding: 0 !important;
    background: none !important;
    border: none !important;
  }

  .workspace-icon,
  .section-label,
  .workspace-copy p,
  .table-actions,
  .gantt-toolbar-actions,
  .gantt-timeline-nav,
  .org-controls,
  .task-manager-toolbar,
  .cost-controls,
  .cost-header-actions,
  .board-filter,
  .resource-add-task,
  #resource-add-task-button {
    display: none !important;
  }

  .workspace-copy h2 {
    margin: 0 !important;
    font-size: 14pt !important;
    font-weight: 700 !important;
    color: #111 !important;
  }

  .table-wrapper {
    overflow: visible !important;
    padding: 0 !important;
    border: none !important;
    background: #fff !important;
  }

  table {
    width: 100% !important;
    min-width: 0 !important;
    border-collapse: collapse !important;
    font-size: 8.5pt !important;
    page-break-inside: auto;
  }

  thead {
    display: table-header-group;
  }

  tr {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  th,
  td {
    padding: 4px 6px !important;
    border: 1px solid #c5cdd8 !important;
    vertical-align: top !important;
    color: #111 !important;
    background: #fff !important;
  }

  th {
    background: #e8edf3 !important;
    font-size: 7.5pt !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    letter-spacing: 0.03em;
  }

  tr:nth-child(2n) td {
    background: #f6f8fb !important;
  }

  td[contenteditable="true"]:focus {
    background: inherit !important;
    box-shadow: none !important;
  }

  select,
  input,
  textarea {
    border: none !important;
    padding: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    appearance: none;
  }

  input[type="checkbox"] {
    appearance: auto;
    width: 12px !important;
    height: 12px !important;
  }

  .icon-action,
  .row-action-group,
  .material-icons,
  .board-card-actions {
    display: none !important;
  }

  /* Task list */
  body[data-print-view="schedule"] #programme-table th:last-child,
  body[data-print-view="schedule"] #programme-table td:last-child {
    display: none !important;
  }

  body[data-print-view="schedule"] #programme-table tbody tr.programme-row-dependency-warning td {
    background: #fde8e8 !important;
  }

  /* Organisation */
  body[data-print-view="organisation"] #org-table .org-actions-cell,
  body[data-print-view="organisation"] #org-table th:last-child {
    display: none !important;
  }

  body[data-print-view="organisation"] #org-container .table-wrapper {
    margin-bottom: 6mm;
  }

  body[data-print-view="organisation"] .infograph {
    overflow: visible !important;
  }

  body[data-print-view="organisation"] #orgHierarchyTree {
    display: block !important;
    max-width: 100% !important;
    height: auto !important;
  }

  body[data-print-view="organisation"] #org-print-fit {
    margin-top: 4mm;
  }

  /* Task manager */
  body[data-print-view="task-manager"] .workspace-header {
    display: none !important;
  }

  body[data-print-view="task-manager"] .task-manager-toolbar,
  body[data-print-view="task-manager"] .resource-task-container,
  body[data-print-view="task-manager"] .resource-add-task {
    display: none !important;
  }

  body[data-print-view="task-manager"] .task-manager-print-host {
    display: block !important;
    margin-bottom: 5mm !important;
  }

  body[data-print-view="task-manager"] .task-manager-print-title {
    margin: 0 0 2mm !important;
    font-size: 12pt !important;
    font-weight: 700 !important;
    color: #111 !important;
  }

  body[data-print-view="task-manager"] .task-manager-print-meta {
    margin: 0 0 3mm !important;
    font-size: 8.5pt !important;
    color: #444 !important;
  }

  body[data-print-view="task-manager"] .task-manager-print-table {
    width: 100% !important;
    font-size: 7.5pt !important;
  }

  body[data-print-view="task-manager"] .task-manager-allocation {
    margin-bottom: 5mm !important;
  }

  body[data-print-view="task-manager"] .resource-allocation-shell,
  body[data-print-view="task-manager"] .resource-allocation-frame {
    overflow: visible !important;
    width: auto !important;
    height: auto !important;
    transform: none !important;
    border: 1px solid #c5cdd8 !important;
  }

  body[data-print-view="task-manager"] .resource-allocation-scroll {
    overflow: visible !important;
  }

  body[data-print-view="task-manager"] .resource-allocation-chart {
    max-width: 100% !important;
  }

  body.hide-financials[data-print-view="schedule"] #programme-table th.programme-cost-column,
  body.hide-financials[data-print-view="schedule"] #programme-table td.programme-cost-column,
  body.hide-financials[data-print-view="task-manager"] .task-manager-print-cost {
    display: none !important;
  }

  /* Gantt */
  body[data-print-view="gantt"] .gantt-timeline-rail {
    display: none !important;
  }

  body[data-print-view="gantt"] #gantt-print-area {
    padding: 0 !important;
    overflow: hidden !important;
  }

  body[data-print-view="gantt"] .gantt-chart-scroll,
  body[data-print-view="gantt"] .gantt-planner,
  body[data-print-view="gantt"] .gantt-timeline-shell,
  body[data-print-view="gantt"] .gantt-chart-pane {
    overflow: visible !important;
  }

  body[data-print-view="gantt"] .gantt-chart-svg {
    display: none !important;
  }

  body[data-print-view="gantt"] .gantt-print-raster-host {
    display: block !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  body[data-print-view="gantt"] .gantt-print-raster {
    display: block !important;
    max-width: 100% !important;
    height: auto !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  body[data-print-view="gantt"] .print-fit-host {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  /* Status board */
  body[data-print-view="board"] .workspace-header {
    display: none !important;
  }

  body[data-print-view="board"] #board-print-area {
    padding: 0 !important;
    overflow: hidden !important;
    transform: none !important;
    width: auto !important;
    height: auto !important;
  }

  body[data-print-view="board"] #kanbanBoard {
    scale: none !important;
    transform: none !important;
  }

  body[data-print-view="board"] .board-root,
  body[data-print-view="board"] .infograph-board {
    min-width: 0 !important;
    overflow: visible !important;
  }

  body[data-print-view="board"] .board-grid {
    display: grid !important;
    grid-auto-flow: column !important;
    grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
    grid-auto-columns: minmax(0, 1fr) !important;
    gap: 8px !important;
    min-width: 0 !important;
    width: 100% !important;
  }

  body[data-print-view="board"] .board-column {
    min-height: 0 !important;
    padding: 8px !important;
    border-radius: 10px !important;
    box-shadow: none !important;
  }

  body[data-print-view="board"] .board-card {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    -webkit-column-break-inside: avoid;
  }

  body[data-print-view="board"] .board-column-list {
    page-break-inside: auto;
  }

  body[data-print-view="board"] .board-column-header {
    padding: 8px 10px !important;
    border-radius: 8px !important;
  }

  body[data-print-view="board"] .board-column-title {
    font-size: 9pt !important;
    line-height: 1.2 !important;
  }

  body[data-print-view="board"] .board-column-count {
    font-size: 7pt !important;
  }

  body[data-print-view="board"] .board-column-list {
    width: 100% !important;
    gap: 8px !important;
  }

  body[data-print-view="board"] .board-card {
    min-height: 0 !important;
    padding: 8px !important;
    gap: 6px !important;
    border-radius: 10px !important;
    border-width: 2px !important;
    box-shadow: none !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  body[data-print-view="board"] .board-card-title {
    font-size: 8.5pt !important;
    line-height: 1.25 !important;
  }

  body[data-print-view="board"] .board-card-owner,
  body[data-print-view="board"] .board-meta-label,
  body[data-print-view="board"] .board-footer-note {
    font-size: 7pt !important;
  }

  body[data-print-view="board"] .board-meta-value {
    font-size: 7.5pt !important;
  }

  body[data-print-view="board"] .board-meta-grid {
    gap: 4px !important;
  }

  body[data-print-view="board"] .board-meta-item {
    padding: 4px 6px !important;
  }

  /* Cost monitoring */
  body[data-print-view="cost"] .workspace-header,
  body[data-print-view="cost"] .cost-controls {
    display: none !important;
  }

  body[data-print-view="cost"] .cost-monitoring-wrapper {
    padding: 0 !important;
    border: none !important;
    background: #fff !important;
  }

  body[data-print-view="cost"] #invoice-display {
    display: block !important;
    width: 100% !important;
    transform: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
  }

  body[data-print-view="cost"] .invoice-summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }

  body[data-print-view="cost"] .invoice-table {
    font-size: 8pt !important;
  }
}
