/* Packing slip generator: screen form + A4 sheet preview + print rules.
   Shares the .st-* chrome from seller-tools.css; ps-* is tool-specific. */
.ps-shell { max-width: 1180px; }
.ps-console { grid-template-columns: 400px 1fr; }
@media (max-width: 960px) { .ps-console { grid-template-columns: 1fr; } }

.ps-req { color: #b91c1c; font-weight: 700; }
.ps-mini { min-height: 68px; font-family: inherit; }
.ps-h2 { font-size: 14px; margin: 18px 0 8px; }

/* item-line editor */
.ps-rowhead { display: grid; grid-template-columns: minmax(0,2fr) minmax(0,1.2fr) 74px minmax(0,1.3fr) 32px; gap: 8px; font-size: 12px; font-weight: 600; color: var(--ink-soft, #6b7280); padding: 0 2px 4px; }
.ps-row { display: grid; grid-template-columns: minmax(0,2fr) minmax(0,1.2fr) 74px minmax(0,1.3fr) 32px; gap: 8px; margin-bottom: 8px; position: relative; }
.ps-row .st-input { padding: 9px 10px; font-size: 13px; }
.ps-row input[aria-invalid="true"], #ps-order[aria-invalid="true"], #ps-date[aria-invalid="true"] { border-color: #dc2626; background: #fef2f2; }
.ps-del { width: 32px; height: 38px; border: 1px solid var(--line, #d1d5db); border-radius: 9px; background: #fff; color: var(--ink-soft, #6b7280); font-size: 15px; line-height: 1; cursor: pointer; }
.ps-del:hover { border-color: #dc2626; color: #dc2626; }
.ps-add { margin-top: 2px; }
.ps-stats { margin: 12px 0 0; font-weight: 600; }
#ps-status { margin-top: 8px; }
@media (max-width: 640px) {
  .ps-rowhead { display: none; }
  .ps-row { grid-template-columns: 1fr 1fr; border: 1px solid var(--line, #e5e7eb); border-radius: 10px; padding: 12px 10px 10px; }
  .ps-row .c-name, .ps-row .c-note { grid-column: 1 / -1; }
  .ps-row .ps-del { position: absolute; top: 6px; right: 6px; height: 30px; }
}

/* A4 sheet preview */
.ps-preview-card { padding: 14px; }
.ps-preview-tag { font-size: 12px; color: var(--ink-soft, #9ca3af); margin: 0 0 10px; }
.ps-sheet-wrap { background: #eceff3; border-radius: 10px; padding: 16px; overflow-x: auto; }
.ps-sheet { background: #fff; color: #111827; width: 100%; max-width: 794px; margin: 0 auto; box-shadow: 0 2px 14px rgba(15, 23, 42, .12); border: 1px solid #e5e7eb; padding: 36px 34px; box-sizing: border-box; font-size: 13px; line-height: 1.55; }

.ps-doc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; border-bottom: 2px solid #111827; padding-bottom: 12px; }
.ps-doc-title { font-size: 22px; letter-spacing: .04em; margin: 0; }
.ps-doc-title small { display: block; font-size: 11px; letter-spacing: .28em; color: #6b7280; font-weight: 600; margin-top: 2px; }
.ps-meta { text-align: right; font-size: 12px; }
.ps-meta div { margin-bottom: 3px; }
.ps-meta b { display: inline-block; min-width: 62px; color: #6b7280; font-weight: 600; text-align: left; }
.ps-meta .v { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 600; overflow-wrap: anywhere; }

.ps-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 14px 0; }
.ps-party { border: 1px solid #d1d5db; border-radius: 8px; padding: 10px 12px; min-width: 0; }
.ps-party b { display: block; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: #6b7280; margin-bottom: 4px; }
.ps-party p { margin: 0; white-space: pre-line; overflow-wrap: anywhere; font-size: 12.5px; }

.ps-table { width: 100%; border-collapse: collapse; margin-top: 4px; font-size: 12.5px; }
.ps-table th { text-align: left; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: #374151; border-bottom: 1.5px solid #111827; padding: 7px 8px; }
.ps-table td { border-bottom: 1px solid #d1d5db; padding: 7px 8px; vertical-align: top; overflow-wrap: anywhere; word-break: break-word; }
.ps-table .c-idx, .ps-table .c-qty { text-align: right; white-space: nowrap; }
.ps-table .c-idx { color: #6b7280; width: 30px; }
.ps-table .c-qty { width: 56px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.ps-table .c-sku { width: 22%; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.ps-table .c-note { width: 26%; }
.ps-empty-row td { text-align: center; color: #9ca3af; padding: 18px 8px; font-style: italic; }

.ps-doc-foot { margin-top: 12px; display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.ps-doc-foot .tot { font-weight: 700; font-size: 14px; }
.ps-doc-foot .tot b { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 16px; }
.ps-doc-note { margin-top: 18px; font-size: 11px; color: #9ca3af; }

/* print: keep only the sheet, let the table paginate naturally.
   seller-tools.css has a global `body * { visibility:hidden }` print rule
   (for the barcode tool's #st-print area) — re-show our sheet subtree. */
@media print {
  @page { size: A4 portrait; margin: 12mm; }
  #ps-sheet, #ps-sheet * { visibility: visible !important; }
  .site-header, .site-footer, .skip-link,
  .st-shell > *:not(.ps-console),
  .ps-console > *:not(.ps-preview-card),
  .ps-preview-tag { display: none !important; }
  main#content, .st-shell.ps-shell { padding: 0 !important; margin: 0 !important; max-width: none !important; }
  .st-console.ps-console { display: block !important; }
  .ps-preview-card { border: 0 !important; padding: 0 !important; box-shadow: none !important; }
  .ps-sheet-wrap { background: none !important; padding: 0 !important; overflow: visible !important; }
  .ps-sheet { max-width: none !important; width: auto !important; margin: 0 !important; border: 0 !important; box-shadow: none !important; padding: 0 !important; }
  .ps-table thead { display: table-header-group; }
  .ps-table tr { break-inside: avoid; }
  .ps-doc-head, .ps-parties, .ps-doc-foot { break-inside: avoid; }
}
