body {
  background-color: #f4f6f9;
}
.card-header {
  font-weight: 600;
}
table input.form-control, table select.form-select {
  min-width: 100px;
}

/* Report/list tables can get wide (many columns) — keep dates and similar
   short values from wrapping onto two lines, which makes rows taller and
   harder to scan. The table's own .table-responsive wrapper already
   provides horizontal scrolling if a row genuinely needs more space. */
.table-responsive table td, .table-responsive table th {
  white-space: nowrap;
}
/* Remarks/description/address-style columns are the exception — these are
   free text and SHOULD wrap normally rather than forcing the row wide. */
.table-responsive table td.wrap-text, .table-responsive table th.wrap-text {
  white-space: normal;
}

/* ============================================================
   Mobile (<768px): smaller text/controls so forms, master-entry
   pages, and reports fit without horizontal scrolling, plus more
   compact headings and stat boxes.
   ============================================================ */
@media (max-width: 767px) {
  body { font-size: 0.85rem; }

  h3 { font-size: 1.25rem; }
  h4 { font-size: 1.1rem; }
  h5 { font-size: 1rem; }
  h6 { font-size: 0.9rem; }

  .form-control, .form-select, .btn, .form-check-label, .form-label {
    font-size: 0.8rem;
  }
  .form-control, .form-select {
    padding: 0.25rem 0.5rem;
  }
  .btn-sm { font-size: 0.75rem; padding: 0.2rem 0.5rem; }

  .table { font-size: 0.75rem; }
  table input.form-control, table select.form-select {
    min-width: 70px;
    font-size: 0.75rem;
  }

  /* Pack short fields two-per-row instead of stacking every .col-md-*
     field full-width — this is what shortens long entry forms and report
     filter rows on a phone screen. Scoped to inside <form> elements only,
     so it never touches page-layout columns (e.g. a centered login card)
     that just happen to use the same col-md-* classes for a different
     purpose. Fields that genuinely need the full width (textareas, long
     free-text) should carry the .full-width-mobile class to opt back out. */
  form .row > [class*="col-md-"]:not(.full-width-mobile) {
    flex: 0 0 50%;
    max-width: 50%;
  }

  /* Coloured summary/stat boxes (Home page, report summary rows): more
     per row and less padding, so they read as a compact grid instead of
     a few oversized tiles stacked vertically. */
  .row > [class*="col-6"] {
    flex: 0 0 50%;
    max-width: 50%;
  }
  .card-body { padding: 0.6rem; }
  .card-body .fs-3 { font-size: 1.1rem !important; }
  .card-body .fs-4 { font-size: 1rem !important; }
  .card-body .fs-5 { font-size: 0.95rem !important; }
}

/* ============================================================
   Print: table view only (card view, if active, is switched off by
   JS before printing — see partials/footer.ejs), no scrollbars, and
   content sized to actually fit the page instead of being clipped.
   ============================================================ */
/* Card/Table view toggle for reports (see public/js/reportView.js) */
.report-card-view .card-body strong {
  color: #555;
}
#reportViewToggle .btn.active {
  background-color: #212529;
  color: #fff;
}

@media print {
  .no-print {
    display: none !important;
  }
  body {
    background-color: #fff;
    font-size: 11px;
  }
  .table-responsive {
    overflow: visible !important;
    display: block !important;
  }
  .report-card-view {
    display: none !important;
  }
  table {
    font-size: 11px;
  }
  .card-body { padding: 0.4rem !important; }
  .card-body .fs-3, .card-body .fs-4, .card-body .fs-5 { font-size: 0.85rem !important; }
  .row > [class*="col-6"], .row > [class*="col-md-3"] {
    flex: 0 0 25% !important;
    max-width: 25% !important;
  }
}

