/* Loaded last, for print only. Keep long documents paginated at readable size. */
@page { size: A5 portrait; margin: 6mm; }
@media print {
  :root, body { background: #fff; color: #111; font-size: 8.5pt; line-height: 1.2; }
  .app-header, .test-banner, .back, .shell > [data-action="home"],
  .foot-actions, .detail-actions, .test-link, .no-print, #toast, dialog,
  [data-review], .required, .print-attachments, .file-list { display: none !important; }
  .shell { width: 100%; max-width: none; margin: 0; padding: 0; }
  .form-layout { display: block; }
  .sidebar { position: static; }
  .page-heading { display: block; margin: 0 0 .5mm; padding: 0; }
  .page-heading > div:first-child { display: flex; align-items: baseline; flex-wrap: wrap; gap: 1mm 3mm; }
  h1 { font-size: 14pt; line-height: 1.2; margin: 0 0 1mm; letter-spacing: 0; }
  .page-heading p, .shell > p { margin: 0 0 .5mm; font-size: 8pt; }
  .panel, .sidebar .panel { padding: .5mm 0; margin: 0; border: 0; border-top: .2mm solid #aaa; border-radius: 0; break-inside: auto; }
  .section-title { margin: 0 0 .4mm; padding: 0; gap: 2mm; break-after: avoid; }
  .panel h2, .sidebar .panel h2 { font-size: 10pt; margin: 0; }
  .panel h3, .finance-item h3, .expense-item h3, .supplement-entry h3 { font-size: 9pt; margin: 0 0 .5mm; break-after: avoid; }
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .3mm 2mm; }
  .field.wide { grid-column: 1 / -1; }
  .panel > .grid, .panel > .field, .expense-item .grid, .period-total { margin: .5mm 0 0; }
  .field { break-inside: auto; }
  .field label.label { display: inline; font-size: inherit; font-weight: 600; margin: 0; color: #333; }
  .field label.label::after { content: '：'; }
  .readonly { display: inline; min-height: 0; padding: 0; font-size: inherit; line-height: inherit; color: #111; white-space: pre-line; overflow-wrap: anywhere; word-break: break-word; }
  p, .hint, .history p { margin: .5mm 0; font-size: inherit; line-height: inherit; }
  small, .muted, .hint, .flow small, .history small, .supplement-entry h3 small { color: #444; font-size: 8pt; line-height: inherit; }
  .summary { padding: 1mm 2mm; margin-top: 1mm; border: .2mm solid #aaa; border-radius: 0; gap: 2mm; background: none; break-inside: avoid; }
  .summary strong { color: #111; font-size: 11pt; }
  .summary small { margin: 0; }
  .finance-period, .finance-item, .expense-item, .allocation-row, .supplement, .supplement-entry { padding: .5mm 0; margin: 0; border-color: #ccc; break-inside: auto; }
  .allocation-row > strong { float: right; display: inline; margin: 0; }
  .supplement-entry { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 2mm; }
  .supplement-entry h3 { font-size: 8.5pt; }
  .supplement-entry .file-list { display: flex; flex-wrap: wrap; gap: 0 2mm; }
  .field:has([id*="row-content"]), .field:has([for*="row-content"]) { grid-column: 1 / -1; }
  .file-list { margin: 0; }
  .file-list li { padding: .3mm 0; border: 0; gap: 1mm; }
  .file-name, .attachment-link { font-size: 8pt; line-height: 1.3; white-space: normal; overflow: visible; text-overflow: clip; color: #111; overflow-wrap: anywhere; }
  .panel ul:not(.file-list) { margin: .5mm 0; padding-left: 4mm; }
  button[data-related-view] { min-height: 0; padding: 0; border: 0; font-size: inherit; color: #111; text-align: left; white-space: normal; }
  .history li { margin: 0; padding: .5mm 0; border: 0; break-inside: auto; }
  .history li::before, .flow li::before { display: none; }
  .history-head { display: flex; flex-wrap: wrap; gap: 1mm 3mm; font-size: inherit; }
  .history-head small { display: inline; margin: 0; white-space: normal; }
  .flow { display: block; }
  .flow li { margin: 0; padding: .5mm 0; border: 0; font-size: 8pt; break-inside: avoid; }
  .flow small { display: inline; margin: 0 0 0 2mm; }
  .tag { padding: 0 1mm; border-radius: 0; font-size: 8pt; color: #111 !important; background: none !important; }
  .note { padding: 1mm; margin: 1mm 0; font-size: 8pt; }
  /* Existing business rule: do not print the supplier name. */
  .supplier-print-hidden { display: none !important; }
}
