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

/* Number entry boxes read better right-aligned (qty/rate/amount/discount/
   balances/etc.) — applied everywhere, not just inside tables. */
input[type="number"] {
  text-align: right;
}

/* Discount value box: no up/down spinner arrows — the % / Amt toggle next
   to it makes them more confusing than useful. */
.no-spinner::-webkit-outer-spin-button,
.no-spinner::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.no-spinner {
  -moz-appearance: textfield;
}

/* 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;
}

/* ============================================================
   Typeahead (public/js/typeahead.js) — search-as-you-type dropdown used
   for Supplier/Item pickers.
   ============================================================ */
.typeahead-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 1050;
  max-height: 260px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #ced4da;
  border-radius: 0.375rem;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
  margin-top: 2px;
}
.typeahead-item {
  padding: 6px 10px;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
}
.typeahead-item:last-child { border-bottom: none; }
.typeahead-item:hover, .typeahead-item.active {
  background-color: #eef4ff;
}
.typeahead-item-main {
  font-size: 0.9rem;
}
.typeahead-item-sub {
  font-size: 0.75rem;
  color: #777;
}
.typeahead-empty {
  padding: 8px 10px;
  color: #888;
  font-size: 0.85rem;
}

/* ============================================================
   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. Fields that genuinely need the full
     width (textareas, long free-text) should carry the .full-width-mobile
     class to opt back out. */
  .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;
  }
}

