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

/* Used on report pages (and anywhere else with a .no-print element) so the
   navbar, filter form, and action buttons disappear when printing, leaving
   just the report title and results table. */
@media print {
  .no-print {
    display: none !important;
  }
  body {
    background-color: #fff;
  }
  /* Bootstrap's .table-responsive sets overflow-x: auto so a wide report
     table can be dragged/scrolled sideways on screen. Printed output has
     no way to scroll, so that same "auto" just clips whatever falls
     outside the div's on-screen width — and some browsers go further and
     paint the (non-functional) scrollbar itself into the printed page,
     which is the stray scrollbar the report print/PDF was showing.
     Printing needs the opposite: let the table render at its full
     natural width with nothing clipped, so every column actually makes
     it onto the page instead of behind an invisible scroll boundary. */
  .table-responsive {
    overflow: visible !important;
    display: block !important;
    width: auto !important;
  }
}

/* Opposite of .no-print: hidden on screen, shown only when printing. Used
   for "print everything that matches the filter" tables on reports that
   are paginated on screen (e.g. the Member Report) — the on-screen table
   only shows the current page, but this one holds every matching row. Also
   used by views/partials/reportPrintHeader.ejs (see the rules just below)
   for the shop letterhead + report title shown only on a printed report. */
.print-only {
  display: none;
}
@media print {
  .print-only {
    display: block !important;
  }
}

/* views/partials/reportPrintHeader.ejs's shop letterhead + report title —
   included at the top of every list-style report/register page, since
   their on-screen title bar and filter card are both .no-print and would
   otherwise leave a printed page with no heading or shop identity at all.
   Wrapped in .print-only above, so these rules only ever matter while
   printing regardless of where they're declared. */
.report-print-header {
  text-align: center;
  border-bottom: 1px solid #333;
  padding-bottom: 8px;
  margin-bottom: 10px;
}
.report-print-shop-name {
  font-size: 16px;
  font-weight: 700;
}
.report-print-shop-address,
.report-print-shop-contact {
  font-size: 11px;
  color: #444;
}
.report-print-title {
  font-size: 13px;
  font-weight: 700;
  text-decoration: underline;
  margin-top: 6px;
}

/* Small "(i)" info icon used next to a form label instead of a long
   helper-text paragraph underneath the field — keeps forms compact and
   readable on mobile. Full explanation shows as a tooltip on tap/hover. */
.field-info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background-color: #6c757d;
  color: #fff;
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  cursor: help;
  margin-left: 4px;
  vertical-align: middle;
}

/* Member Tree report: highlights a row that matches the search box, and
   makes sure it's visible even when its parent nodes are printed/expanded. */
.tree-highlight {
  background-color: #fff3cd;
  border-radius: 4px;
}
.tree-toggle {
  line-height: 1;
}

/* Home page: "Last 5 Job Cards" rows are clickable (open that job card) —
   hover highlight makes that discoverable. */
.recent-job-card-row:hover {
  background-color: #f1f3f5;
}

/* Job Card item rows: "clubbed" items (several Parts/Labour lines sharing
   one Qty/Rate/Amount) get a left-accent border so a group is easy to pick
   out at a glance, both on the entry form and on Job Card / Bill print. */
.item-row-grouped td:first-child,
tr.clubbed-row td:first-child {
  border-left: 3px solid #0d6efd !important;
}
.item-clubbed-note {
  margin-top: 2px;
}
.clubbed-group-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  color: #0d6efd;
  background-color: #e7f1ff;
  border-radius: 3px;
  padding: 0 5px;
  margin-left: 6px;
  vertical-align: middle;
}

/* Item Picker — shared rich search/batch combobox dropdown used by every
   transaction entry screen (see public/js/itemPicker.js). Positioned as
   position:fixed by the JS itself (so it can escape a scrollable table
   wrapper), this just handles its look. */
.item-picker-dropdown {
  z-index: 2000;
  background: #fff;
  border: 1px solid #ced4da;
  border-radius: 4px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.15);
  max-height: 320px;
  overflow-y: auto;
}
.item-picker-row {
  padding: 6px 10px;
  cursor: pointer;
  border-bottom: 1px solid #f1f1f1;
}
.item-picker-row:last-child {
  border-bottom: none;
}
.item-picker-row:hover,
.item-picker-row.active {
  background-color: #e7f1ff;
}
.item-picker-desc {
  font-size: 0.875rem;
  font-weight: 500;
  color: #212529;
}
.item-picker-meta {
  font-size: 0.75rem;
  color: #6c757d;
}

/* Item Picker — quick item-create modal (see public/js/itemPicker.js's
   setupQuickCreate()). Plain fixed-position overlay rather than pulling
   in Bootstrap's JS modal machinery, since this needs to work from
   inside a dynamically-built dropdown row with no server-rendered modal
   markup to hook into. As of 2026-09 the dialog body is the exact same
   Bootstrap row/col-md-* form fetched from views/admin/_item-form-fields.ejs
   (see routes/inventoryRoutes.js's GET /items/quick-create-form) rather
   than a hand-built field grid, so it's sized to match that form's own
   card (max-width:750px on views/admin/service-items.ejs) instead of a
   bespoke .qc-grid. */
/* Page top bar -- 2026-09 "heading of Purchase and sales condumes lots of
   vertical space. make it simple and put on top row left most in the tab
   strip row. also put prev search bill on right top of the same row" --
   shared by views/purchases/form.ejs and views/sales/form.ejs: one row
   carrying the page's own compact label, the Bill Tabs strip, and the
   previous-bill quick search side by side, replacing what used to be
   three separate full-width rows (a centered <h4> title, the tab strip,
   and the search box) each claiming their own vertical space. flex-wrap
   lets it break onto more than one line on a narrow screen rather than
   squeezing everything into one -- title first (always fits), then the
   tab strip, then the search box, in that order. */
.page-topbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .4rem .75rem;
  margin-bottom: .5rem;
  padding-bottom: .35rem;
  border-bottom: 1px solid #dee2e6;
}
.page-topbar-title {
  flex: 0 0 auto;
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  color: #343a40;
}
.page-topbar-tabs {
  flex: 1 1 240px;
  min-width: 160px;
}
.page-topbar-search {
  flex: 0 1 320px;
  min-width: 200px;
}

/* Bill Tabs -- 2026-09 "all the openeed unsaved bills should come in top
   as a tab strip" -- shared by views/purchases/form.ejs and views/sales/
   form.ejs (New and Edit), rendered by public/js/billTabs.js. Sits inside
   .page-topbar-tabs above now, which owns the shared row's own bottom
   border/spacing -- this strip no longer needs its own. */
.bill-tab-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .3rem;
}
.bill-tab {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .2rem .5rem;
  border: 1px solid #ced4da;
  border-radius: 4px 4px 0 0;
  background: #f1f3f5;
  font-size: .8rem;
  color: #495057;
  max-width: 180px;
}
.bill-tab.active {
  background: #fff;
  border-color: #86b7fe;
  border-bottom-color: #fff;
  color: #212529;
  font-weight: 600;
}
.bill-tab-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bill-tab-close {
  border: none;
  background: none;
  line-height: 1;
  padding: 0 .1rem;
  color: #868e96;
  font-size: .95rem;
}
.bill-tab-close:hover { color: #dc3545; }
.bill-tab-new {
  border: 1px dashed #adb5bd;
  border-radius: 4px;
  background: none;
  font-size: .78rem;
  padding: .2rem .5rem;
  color: #495057;
}
.bill-tab-new:hover { background: #f8f9fa; }

.item-picker-quickcreate-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 3000;
  align-items: center;
  justify-content: center;
}
.item-picker-quickcreate-dialog {
  background: #fff;
  border-radius: 6px;
  padding: 16px 18px;
  width: 800px;
  max-width: 94vw;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: 0 8px 30px rgba(0,0,0,0.25);
}

/* Quick-create modal for the Purchase form's Supplier dropdown — same
   generic overlay/dialog visuals as the Item Picker's quick-create
   modal (public/js/itemPicker.js), duplicated rather than shared since
   this one is wired up directly in views/purchases/form.ejs, not
   itemPicker.js's domain. */
.party-quickcreate-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 3000;
  align-items: center;
  justify-content: center;
}
.party-quickcreate-dialog {
  background: #fff;
  border-radius: 6px;
  padding: 16px 18px;
  width: 320px;
  max-width: 90vw;
  box-shadow: 0 8px 30px rgba(0,0,0,0.25);
}

/* Job Card-related report tables (Register, Billing, Vehicle History) on
   mobile: a small Table/Cards toggle button (top of each report, mobile
   only) lets the user pick between two views, remembered per-table via
   localStorage:
     - Table (default): the normal <table>, just with .table-compact-
       mobile's smaller fonts/padding so it's less cramped, scrolling
       horizontally if it still doesn't quite fit.
     - Cards (.cards-active, toggled by JS): each row becomes a compact
       card — a 2-column grid of label/value pairs (not one long
       vertical list) so a record reads in less vertical space, with its
       first column (the row's own identifier — JC No, Date, etc.) as a
       bold full-width heading at the top of the card and its actions
       (Edit/Print/Delete/Generate Bill/...) as a full-width button row
       at the bottom.
   Every <td> needs a matching data-label="..." attribute (its column
   header's text) for the label line shown above its value in Cards
   mode. Service section only for now — Inventory's own transaction
   tables aren't touched here. */
@media (max-width: 767.98px) {
  .table-mobile-cards.cards-active thead {
    display: none;
  }
  .table-mobile-cards.cards-active,
  .table-mobile-cards.cards-active tbody {
    display: block;
    width: 100%;
  }
  .table-mobile-cards.cards-active tbody tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.25rem 0.6rem;
    margin-bottom: 0.6rem;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 0.55rem 0.7rem;
    background: #fff;
  }
  .table-mobile-cards.cards-active td {
    display: block;
    border: none !important;
    padding: 0 !important;
    text-align: left !important;
    font-size: 0.72rem;
  }
  .table-mobile-cards.cards-active td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-weight: 600;
    color: #6c757d;
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
  }
  /* The row's own identifying column (always listed first) reads as a
     bold full-width heading across the top of the card instead of just
     another grid cell. */
  .table-mobile-cards.cards-active td:first-child {
    grid-column: 1 / -1;
    font-size: 0.85rem;
    font-weight: 700;
    padding-bottom: 0.35rem !important;
    margin-bottom: 0.15rem;
    border-bottom: 1px solid #eee !important;
  }
  /* Row-level action buttons (Edit/Print/Delete/Generate Bill, etc.) get
     the full card width as a wrapped button row at the bottom. */
  .table-mobile-cards.cards-active td.table-mobile-actions {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    padding-top: 0.4rem !important;
  }
  .table-mobile-cards.cards-active tfoot {
    display: block;
  }
  /* Same 2-column grid as the body rows (not a tall single-column
     stack) — the "Total" cell (always first; colspan is meaningless
     once grid layout takes over from the table model, so it's spanned
     explicitly instead) reads as a full-width heading, and
     Billed/Discount/Paid/Pending land two-per-line beneath it. */
  .table-mobile-cards.cards-active tfoot tr {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.25rem 0.6rem;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 0.55rem 0.75rem;
    margin-top: 0.25rem;
  }
  .table-mobile-cards.cards-active tfoot td,
  .table-mobile-cards.cards-active tfoot th {
    display: block;
    border: none !important;
    text-align: left !important;
    padding: 0.15rem 0 !important;
  }
  .table-mobile-cards.cards-active tfoot tr > :first-child {
    grid-column: 1 / -1;
    font-size: 0.8rem;
  }
  .table-mobile-cards.cards-active tfoot td:empty,
  .table-mobile-cards.cards-active tfoot th:empty {
    display: none;
  }
  /* Totals row cells (Billed/Discount/Paid/Pending) otherwise show up as
     bare numbers with nothing saying what they are — same data-label
     convention and label styling as the body rows above. */
  .table-mobile-cards.cards-active tfoot td[data-label]::before,
  .table-mobile-cards.cards-active tfoot th[data-label]::before {
    content: attr(data-label);
    display: block;
    font-weight: 600;
    color: #6c757d;
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
  }
}

/* Table/Cards toggle button itself — small, mobile-only (each report
   view also adds d-md-none to it directly), active state highlighted
   the same way Bootstrap's own .active button state looks. */
.view-mode-toggle .btn.active {
  background-color: #0d6efd;
  color: #fff;
  border-color: #0d6efd;
}

/* Compact mobile sizing for the Job Card entry screen's Parts/Labour/
   Payments tables (views/job-cards/form.ejs) — plain table markup (not
   stacked cards), just shrunk down (fonts, cell padding, input widths)
   so the columns fit a phone screen with little to no horizontal
   scrolling, rather than restructuring the layout itself. Overrides the
   blanket `table input.form-control, table select.form-select { min-
   width: 100px; }` rule above via higher selector specificity (two
   classes beat one class + two type selectors), not !important. */
/* Parts/Labour item-entry column widths — set via classes (rather than
   the inline width="..." these used to carry) so the mobile media query
   below can shrink them without fighting inline-style specificity.
   Description carries no width at all, so under normal table auto-
   layout it simply absorbs whatever width the other columns don't
   need — the narrower these get on a phone, the more room Description
   gets. */
.col-item-check {
  width: 34px;
}
.col-item-qty {
  width: 90px;
}
.col-item-price,
.col-item-amount {
  width: 110px;
}
.col-item-actions {
  width: 90px;
}

@media (max-width: 767.98px) {
  .table-compact-mobile {
    font-size: 0.72rem;
  }
  .table-compact-mobile th,
  .table-compact-mobile td {
    padding: 0.25rem 0.3rem;
  }
  .table-compact-mobile .form-control,
  .table-compact-mobile .form-select {
    font-size: 0.72rem;
    padding: 0.2rem 0.35rem;
    min-width: 0;
  }
  .table-compact-mobile .col-item-check {
    width: 20px;
  }
  .table-compact-mobile .col-item-qty {
    width: 42px;
  }
  .table-compact-mobile .col-item-price,
  .table-compact-mobile .col-item-amount {
    width: 52px;
  }
  .table-compact-mobile .col-item-actions {
    width: 56px;
  }
  .table-compact-mobile .btn-sm {
    font-size: 0.68rem;
    padding: 0.15rem 0.35rem;
  }
  .table-compact-mobile .form-check-input {
    width: 0.9em;
    height: 0.9em;
  }
  /* Report Date columns show "dd-mm-yyyy hh:mm" — at compact mobile
     width/font that string has enough hyphens and spaces for the
     browser to wrap it across up to 5 lines. Forcing the date and time
     halves onto their own line each (via display: block, with
     white-space: nowrap so neither half itself re-wraps) caps it at
     exactly 2 lines. Desktop is untouched — outside this media query
     the two spans just sit inline with a space between, reading exactly
     as before. */
  .table-compact-mobile .report-date,
  .table-compact-mobile .report-time {
    display: block;
    white-space: nowrap;
  }
}

/* Number entry boxes (Qty, Unit Price, Discount, MRP, every rate field,
   etc.) — the browser's native up/down spinner arrows take up space and
   aren't useful for typed entry, so they're hidden app-wide. Typing and
   the Tab/Enter-driven entry flow (see job-cards/form.ejs) both still
   work exactly the same; this only removes the little arrow buttons. */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

/* Home page "Reports" / "Registers" button lists — a lot of buttons with
   some long labels ("Job Card Billing", "Payment Type Statement",
   "Supplier Statement") crowd a phone screen at full desktop button
   size; shrink font/padding on mobile only. */
@media (max-width: 767.98px) {
  .home-links-compact-mobile .btn {
    font-size: 0.72rem;
    padding: 0.3rem 0.55rem;
  }
}

/* Home page's colored stat boxes (Job Status / Today / Invoices —
   views/home.ejs's statBox() helper). Desktop already lays these out
   4-across and 3-across (views/home.ejs's row-cols-4 / row-cols-3), but
   at full size on a phone that meant only 2 fit per row, so a 3- or
   4-box strip turned into 2 tall rows. Shrinking the icon/number/label
   here lets the SAME row-cols count (set directly in the markup now,
   not just at the md breakpoint) actually fit on one line on mobile too
   — same idea as .table-compact-mobile elsewhere: more columns, smaller
   text, shorter page. Base rule keeps the label at the same 0.7rem it
   was always inline-styled to on desktop; only the media query below
   shrinks it further. */
.home-stat-label {
  font-size: 0.7rem;
}
@media (max-width: 767.98px) {
  .home-stat-box .card-body {
    padding: 0.35rem 0.15rem;
  }
  .home-stat-box .bi {
    font-size: 0.8rem;
  }
  .home-stat-box .home-stat-value {
    font-size: 0.8rem !important;
  }
  .home-stat-box .home-stat-label {
    font-size: 0.58rem !important;
  }
}

/* Report pages' colored summary cards (Opening/Closing Balance, Total
   In/Out, Billed/Paid/Pending, etc. — near the top of most reports in
   views/reports/*.ejs). Same idea as .home-stat-* just above: the
   4-card reports now pack col-3 col-md-* (4-across, one more per row
   than the previous col-4 pass) and the 3-card reports stay col-4
   col-md-* (already one row), so this shrinks the number/label text
   further to match the tighter boxes. A printed page (e.g. A4 portrait)
   renders narrower than the 768px md breakpoint too, so the SAME rule
   set below covers both "mobile view" and "print" at once — that's why
   the media query lists both. */
.report-stat-label {
  font-size: 0.75rem;
}
@media (max-width: 767.98px), print {
  .report-stat-box .card-body {
    padding: 0.2rem 0.1rem;
  }
  .report-stat-box .report-stat-value {
    font-size: 0.7rem !important;
  }
  .report-stat-box .report-stat-label {
    font-size: 0.5rem !important;
    line-height: 1.1;
  }
}
