/* ABS Courier waybill print page: A4, two waybills per sheet, same layout as the ABS portal. */
@page { size: A4; margin: 8mm; }
* { box-sizing: border-box; }
body { margin: 0; font: 12px/16px -apple-system, "Segoe UI", Roboto, Arial, sans-serif; color: #000; background: #f0f0f1; }
.toolbar { padding: 10px 16px; background: #fff; border-bottom: 1px solid #ddd; position: sticky; top: 0; z-index: 1; }
.toolbar button { font-size: 14px; padding: 6px 16px; cursor: pointer; }
.sheet { width: 194mm; min-height: 281mm; margin: 12px auto; background: #fff; display: flex; flex-direction: column; gap: 8mm; page-break-after: always; }
.sheet:last-child { page-break-after: auto; }

.waybill { position: relative; overflow: hidden; background: #fff; padding: 14px 24px; break-inside: avoid; }
.waybill.has-carrier { padding-left: 40px; }
.waybill b { font-weight: 700; }

/* Header */
.wb-header { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; margin-bottom: 4px; }
.wb-logo img { display: block; width: 60px; height: 30px; object-fit: contain; }
.wb-codes { display: flex; align-items: center; gap: 8px; }
.qr svg { display: block; width: 35px; height: 35px; }
.wb-barcode { display: flex; flex-direction: column; align-items: center; line-height: 1; }
.wb-barcode span { font-size: 12px; font-weight: 600; margin-top: 2px; }
.wb-dates { justify-self: end; }
.dates { display: flex; height: 34px; overflow: hidden; border: 1px solid #d1d5db; border-radius: 7px; }
.dates div { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 64px; padding: 0 8px; line-height: 1; text-align: center; background: #fafafa; }
.dates div + div { border-left: 1px solid #d1d5db; background: #fff; }
.dates span { font-size: 7.5px; line-height: 9px; font-weight: 600; text-transform: uppercase; letter-spacing: .025em; }
.dates strong { font-size: 9.5px; line-height: 13px; letter-spacing: .1px; white-space: nowrap; }

/* Cards */
.card { border: 1px solid #e5e7eb; border-radius: 6px; margin-bottom: 4px; }
.card-head { display: flex; align-items: center; justify-content: space-between; min-height: 24px; background: rgba(217, 217, 217, .55); font-weight: 600; }
.card-head > span:first-child { padding: 0 12px; white-space: nowrap; }
.card-head .tab { align-self: stretch; display: flex; align-items: center; max-width: 160px; padding: 4px 12px; background: #b4b4b4; border-radius: 0 6px 0 10px; font-weight: 500; text-align: center; }
.card-body { padding: 8px; }
.field { display: flex; align-items: center; gap: 4px; }
.field + .field, .card-body > .inline { margin-top: 4px; }
.chip { display: inline-block; padding: 2px 8px; border: 1px solid #a5a5a5; border-radius: 4px; background: #f1f1f1; font-size: 12px; }

.wb-cards { display: flex; align-items: stretch; gap: 8px; margin-bottom: 4px; }
.wb-cards .card { margin: 0; min-height: 110px; overflow: hidden; display: flex; flex-direction: column; }
.wb-cards .card-body { flex: 1; min-height: 80px; }
.pickup { flex: 0 0 280px; }
.delivery { flex: 1; min-width: 0; position: relative; }
.cash { position: absolute; top: 0; right: 0; min-width: 100px; height: 42px; padding: 0 14px; display: flex; align-items: center; justify-content: center; background: #1f2937; color: #fff; font-size: 18px; border-radius: 0 6px 0 12px; }
.cash strong { font-weight: 900; margin-right: 4px; }

/* Content strip */
.wb-content { display: flex; min-height: 60px; }
.wb-content .card-body { flex: 1; }
.wb-content .inline { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; }
.wb-content .inline .field + .field { margin-top: 0; }
.wb-side { display: flex; align-items: flex-start; flex-shrink: 0; }
.open-note { height: 40px; display: flex; align-items: center; padding: 0 8px; font-weight: 700; white-space: nowrap; }
.runner { display: flex; flex-direction: column; min-width: 85px; max-width: 170px; }
.runner .code { height: 40px; display: flex; align-items: center; justify-content: center; padding: 0 16px; background: #1f2937; color: #fff; font-size: 20px; font-weight: 700; }
.runner .code.last { border-bottom-left-radius: 12px; }
.runner .branch { padding: 4px 10px; border: 1.5px solid #1f2937; border-top: none; border-bottom-left-radius: 12px; text-align: center; font-size: 13px; font-weight: 800; line-height: 1.25; word-break: break-word; }
.runner .branch.alone { border-top: 1.5px solid #1f2937; }

/* Website and hotline, vertical along the left edge */
.wb-contact { position: absolute; left: 24px; top: 110px; writing-mode: vertical-rl; transform: rotate(180deg); display: flex; align-items: center; gap: 4px; font-size: 10px; white-space: nowrap; }
.wb-contact span + svg { margin-top: 6px; }
.wb-contact svg { width: 12px; height: 12px; fill: none; stroke: #ea8303; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

@media print {
	body { background: #fff; }
	.toolbar { display: none; }
	.sheet { margin: 0; }
	* { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
