/* Printing a page (Print / Save as PDF): an invoice, a load, an audit.
 *
 * Loaded with media="print", so none of this touches the screen. The
 * browser's own print to PDF, with the screen's furniture taken away - the
 * top bar, the navigation, the status bar, toasts, buttons and banners meant
 * for the person working - so what is left is the document.
 *
 * The frame is MudBlazor's now (MudAppBar, MudDrawer, MudMainContent, laid out
 * as a grid by shell.css): all of it goes, and the page takes the paper's whole
 * width - no column where the menu was, no offset MudBlazor gives the content
 * beside a drawer. Until 2026-10-04 only the old .osm-topbar/.osm-nav were
 * hidden here, and every printed page kept an empty left column.
 *
 * Black on white whatever theme is chosen, because paper has no dark mode.
 * That is why this is the one stylesheet (with the generated themes.css)
 * allowed literal colours by RepositoryShapeTests.
 */
@page { margin: 14mm 12mm; }

/* ---------------------------------------------------------------------------
 * The frame: never on paper.
 * ------------------------------------------------------------------------ */
.osm-frame-head,
.osm-topbar,
.mud-appbar,
.osm-nav,
.osm-nav-drawer,
.mud-drawer,
.osm-nav-backdrop,
.osm-statusbar,
.osm-skip-link,
.osm-toast-stack,
.mud-snackbar-provider,
.mud-overlay,
#blazor-error-ui { display: none !important; }

html, body, .osm-app, .mud-layout, main, .osm-main, .mud-main-content, .osm-page {
  background: #fff !important;
  color: #000 !important;
}

/* No grid, no drawer offset: the page is the whole sheet. */
.osm-app, .osm-app.mud-layout { display: block !important; min-height: 0 !important; height: auto !important; }
.osm-main, .mud-main-content {
  margin: 0 !important; padding: 0 !important;
  width: auto !important; max-width: none !important;
}
.osm-main > .container.osm-page,
.osm-main > .container-fluid.osm-page,
.osm-main > div > .container.osm-page,
.container.osm-page {
  max-width: none !important; margin: 0 !important; padding: 0 !important;
}

/* TEST and DEMO still say so on paper (a DEMO invoice must never pass for a
   real one) - once, at the top, in ink rather than the screen's stripes. */
.osm-env-ribbon {
  position: static !important; height: auto !important;
  background: none !important; color: #000 !important;
  border: 2px solid #000 !important; margin-bottom: 8px;
}

/* A sticky page header flows with the page; its commands and the breadcrumb
   are for the screen. */
.osm-page-header.is-sticky { position: static !important; margin: 0 !important; padding: 0 0 8px !important; }
.osm-breadcrumb,
.osm-commandbar,
.osm-commandbar-more { display: none !important; }

/* Cards print flat: a hairline, no shadow. */
.mud-paper, .osm-panel { box-shadow: none !important; }
.mud-paper:not(.osm-invoice-document) { border: 1px solid #bbb; }
tr, .mud-paper { break-inside: avoid; }

/* Material tables keep their header on every printed page. */
thead { display: table-header-group; }
.osm-grid > thead th, .osm-table > thead th, .mud-table-head th { position: static !important; background: #fff !important; color: #000 !important; }

/* ---------------------------------------------------------------------------
 * An invoice: the document alone (Components/Billing/InvoiceDocument).
 * Both companies, the number and dates, every line and its charges, the
 * totals and where to pay - nothing of the screen around it.
 * ------------------------------------------------------------------------ */
.osm-page:has(.osm-invoice-document) .mud-alert,
.osm-page:has(.osm-invoice-document) header .mud-button-root,
.osm-page:has(.osm-invoice-document) .osm-section-title,
.osm-page:has(.osm-invoice-document) .osm-panel:not(.osm-invoice-document),
.osm-page:has(.osm-invoice-document) .osm-panel:not(.osm-invoice-document) + p,
.osm-page:has(.osm-invoice-document) .osm-page-header,
.osm-page:has(.osm-invoice-document) .osm-page-lede { display: none !important; }

.osm-invoice-document {
  border: 0 !important;
  box-shadow: none !important;
  background: #fff !important;
  color: #000 !important;
}

.osm-invoice-document a { color: #000 !important; text-decoration: none !important; }
.osm-invoice-document .osm-table > :not(caption) > * > * { background-color: #fff; color: #000; }
.osm-invoice-document .osm-table > thead th { position: static; background: #fff !important; color: #000 !important; }
.osm-invoice-document .osm-table > tbody > tr.osm-row-warning > * { background-color: #fff3cd; }
.osm-invoice-document tr { break-inside: avoid; }
.osm-invoice-document .osm-text-soft,
.osm-invoice-document .osm-text-mute,
.osm-invoice-document .osm-label { color: #444 !important; }

/* ---------------------------------------------------------------------------
 * Print utilities: d-print-none on a screen's controls, d-print-block /
 * -flex / -table on what only paper shows. MudBlazor has no print utilities
 * of its own; these kept the names the pages already used when Bootstrap
 * went (2026-10-05).
 * ------------------------------------------------------------------------ */
.d-print-none { display: none !important; }
.d-print-inline { display: inline !important; }
.d-print-inline-block { display: inline-block !important; }
.d-print-block { display: block !important; }
.d-print-grid { display: grid !important; }
.d-print-inline-grid { display: inline-grid !important; }
.d-print-table { display: table !important; }
.d-print-table-row { display: table-row !important; }
.d-print-table-cell { display: table-cell !important; }
.d-print-flex { display: flex !important; }
.d-print-inline-flex { display: inline-flex !important; }

/* ---------------------------------------------------------------------------
 * Reports (V1300): the report, the page of visuals or the statement alone.
 * Each table, chart and visual stays in one piece on the paper, a report
 * page keeps its canvas grid (48 units, V1312) on a white canvas, and the
 * charts take ink colours whatever the theme - the screen's dark palette
 * would print pale on white. A chart drawn wider than the paper scales down.
 * ------------------------------------------------------------------------ */
.osm-report-print .mud-button-root,
.osm-report-print .osm-report-controls,
.osm-report-print .mud-alert:not(.osm-report-note) { display: none !important; }

.osm-report-print .osm-report-print-head { display: block !important; margin-bottom: 8px; }

.osm-report-print .osm-report-slicerbar { display: none !important; }
.osm-report-canvas { background: #fff !important; border: 0 !important; padding: 0 !important; }
/* Stage 5, what you see is what prints: the canvas's square units scaled to the paper's width, so every
   visual keeps its place and its proportions; a 16:9 page on landscape Letter, a Letter page upright. */
.osm-report-grid {
  display: grid !important;
  grid-template-columns: repeat(48, minmax(0, 1fr)) !important;
  grid-auto-rows: calc(100cqw / 48) !important;
  gap: 0 !important;
}
.osm-report-print.is-wide-paper { page: osm-report-wide; }
.osm-report-print.is-letter-paper { page: osm-report-letter; }
@page osm-report-wide { size: letter landscape; margin: 10mm 10mm; }
@page osm-report-letter { size: letter portrait; margin: 12mm 10mm; }
.osm-report-print .osm-report-tabs, .osm-report-print .osm-report-page-tabs { display: none !important; }
.osm-report-grid > .osm-report-visual { margin: 3px !important; }
.osm-report-visual {
  break-inside: avoid;
  page-break-inside: avoid;
  position: static !important;
  box-shadow: none !important;
  border: 1px solid #bbb !important;
  background: #fff !important;
}
.osm-report-visual .osm-visual-actions { display: none !important; }
.osm-report-visual .osm-chart-plot, .osm-report-visual .osm-visual-table-scroll { overflow: hidden !important; }
.osm-report-visual .osm-chart-canvas { width: auto !important; height: auto !important; }
.osm-report-visual .osm-chart svg { max-width: 100%; height: auto; }
.osm-report-visual .osm-chart-tip { display: none !important; }
.osm-report-visual .osm-visual-table th, .osm-report-visual .osm-visual-table tfoot td { position: static !important; background: #fff !important; }
.osm-report-visual .osm-chart-band { fill-opacity: 0 !important; stroke: none !important; }

.osm-report-print, .osm-report-visual {
  --osm-ink: #111827;
  --osm-ink-soft: #374151;
  --osm-ink-mute: #4b5563;
  --osm-surface: #ffffff;
  --osm-rule: #d1d5db;
  --osm-rule-strong: #9ca3af;
  --osm-accent: #1f4e79;
  --osm-alarm: #8e1b1b;
  --osm-chart-1: #1f4e79;
  --osm-chart-2: #c06c1a;
  --osm-chart-3: #3a7d44;
  --osm-chart-4: #8e3b46;
  --osm-chart-5: #5b4b8a;
  --osm-chart-6: #2a8a8f;
}
.osm-report-visual svg text { fill: #111827 !important; }
.osm-report-visual svg text.is-in { fill: #ffffff !important; }
.osm-report-visual .osm-chart-grid { stroke: #e5e7eb !important; }
.osm-report-visual .osm-tone-good { background: #e6f2e8 !important; color: #14532d !important; }
.osm-report-visual .osm-tone-warn { background: #fdf3d8 !important; color: #713f12 !important; }
.osm-report-visual .osm-tone-bad { background: #fbe4e4 !important; color: #7f1d1d !important; }
.osm-report-visual .osm-tone-accent { background: #e3ecf6 !important; color: #1e3a5f !important; }
.osm-report-visual .osm-data-bar { background: #c9d7e6 !important; }
.osm-report-visual .osm-map { display: none !important; }

/* Reports stage 4: buttons, navigators, the drill-through banner and a point menu are for the screen. */
@media print {
  .osm-report-visual.is-button, .osm-report-visual.is-navigator, .osm-drill-banner, .osm-point-menu, .osm-point-menu-backdrop { display: none !important; }
}
