@media print {

  /* 1. Stat cards: always 3 across */
  .dashboard-totals {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 1rem !important;
    margin-bottom: 1rem !important;
    margin-top: 0.75rem !important;
    padding: 0 0.25rem !important;
  }

  .stat-card {
    min-width: 0 !important;
    max-width: 100% !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  .stat-value-row {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.25rem !important;
  }

  .stat-sublabel {
    white-space: normal !important;
  }

  /* 2. Top 5 sections: 2 across portrait, 4 across landscape */
  .dashboard-grid {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 1rem !important;
    margin-bottom: 1rem !important;
    margin-top: 0.75rem !important;
  }

  @media print and (orientation: landscape) {
    .dashboard-grid {
      grid-template-columns: repeat(4, 1fr) !important;
    }
  }

  .dashboard-card {
    min-width: 0 !important;
    max-width: 100% !important;
    margin-top: 0.75rem !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  /* 3. Activities/student impact: always 2 across */
  .dashboard-activities-impact {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 1rem !important;
    margin-bottom: 1rem !important;
  }

  /* 4. Recent/upcoming activities: full width (stacked vertically) */
  .dashboard-recent-upcoming {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
    margin-bottom: 1rem !important;
  }
}

/* Print stylesheet for dashboard */
@media print {

  /* Hide sidebar */
  .sidebar,
  .Sidebar,
  #sidebar,
  [class*="sidebar"] {
    display: none !important;
  }

  /* Hide navigation, alerts, and non-essential UI */
  nav,
  .navbar,
  .alert,
  .alerts,
  .pagination,
  .print-hide {
    display: none !important;
  }

  /* Remove background colors and box shadows for clean print */
  body,
  .main,
  .dashboard,
  .content,
  .card,
  .container {
    background: #fff !important;
    box-shadow: none !important;
    color: #000 !important;
  }

  /* Expand main content to full width and remove sidebar margin */
  .main,
  .dashboard,
  .content,
  .container,
  .main-content {
    width: 100% !important;
    margin: 0 !important;
    padding: 0.75rem !important;
  }

  /* Remove left margin set for sidebar on main content */
  .main-content {
    margin-left: 0 !important;
  }

  /* Hide buttons and interactive elements (except in page header) */
  button:not(.page-header *),
  .btn:not(.page-header *),
  input:not(.page-header *),
  select:not(.page-header *),
  textarea:not(.page-header *),
  .actions,
  .action-buttons {
    display: none !important;
  }

  /* Optional: Hide footer */
  footer,
  .footer {
    display: none !important;
  }

  /* Optional: Remove links underline and color */
  a {
    color: #000 !important;
    text-decoration: none !important;
  }

  /* Prevent page breaks inside items */
  .distribution-item,
  .impact-item,
  .top-item,
  .activity-table tbody tr {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }
}