@charset "utf-8";
/* Bill page. Shares tokens, buttons and inputs with styles.css. */

.bill-main { max-width: 1240px; margin: 0 auto; padding: 16px; display: flex; flex-direction: column; gap: 16px; }

.bill-head { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.2fr) minmax(0, 1.8fr) minmax(0, 1.2fr) auto; gap: 12px; align-items: end; }
.bill-no {
  height: var(--h); padding: 0 14px; font: inherit; font-weight: 600; white-space: nowrap; cursor: pointer;
  border: 1px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface-2); color: var(--text);
}

.line-head, .line {
  display: grid; gap: 6px; align-items: center;
  grid-template-columns: 26px minmax(0, 1fr) 160px 170px 72px 90px 90px 40px;
}
.line-head { font-size: 13px; color: var(--text-2); padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.line { padding: 6px 0; border-bottom: 1px solid var(--border); }
.line-n { color: var(--text-3); font-size: 14px; text-align: center; }
.line input[type="text"] { padding: 0 8px; }
.line [data-f="qtyRaw"], .line [data-f="priceRaw"] { text-align: right; }
.line input.changed { border-color: var(--warn); background: var(--warn-bg); }
.line-sum, .r { text-align: right; }
.qty-cut { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px; }
.line input[readonly] { background: var(--surface-2); border-style: dashed; color: var(--text); }
.btn-cut {
  height: var(--h); padding: 0 10px; font: inherit; font-size: 14px; font-weight: 600; white-space: nowrap; cursor: pointer;
  border-radius: var(--radius); border: 1px solid var(--accent); background: var(--accent-bg); color: var(--accent);
}
.btn-cut:hover, .btn-cut:focus-visible { background: var(--accent); color: #fff; outline: none; }
.line-sum { font-weight: 600; font-variant-numeric: tabular-nums; }
.line-msg { grid-column: 2 / -1; margin: 0; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 13px; }
.line-msg .warn { color: var(--warn); }
.line-msg .hint { color: var(--text-2); }
.line:last-child .btn-del { visibility: hidden; }
.bill-hint { margin: 10px 0 0; font-size: 13px; }

.bill-totals { display: flex; justify-content: flex-end; margin-top: 14px; padding-top: 12px; border-top: 2px solid var(--border); }
.tot { text-align: right; display: flex; flex-direction: column; gap: 2px; }
.tot div { display: flex; justify-content: flex-end; gap: 14px; align-items: baseline; }
.tot span { color: var(--text-2); font-size: 14px; }
.tot b { font-variant-numeric: tabular-nums; }
.tot .grand b { font-size: 26px; color: var(--accent); }
.tot .vat { font-size: 13px; color: var(--text-3); }
.tot .bad { color: var(--warn); font-size: 13px; }

.dlg-print { width: min(640px, calc(100vw - 32px)); }
.print-choice .btn { flex: 0 0 auto; }
.print-choice kbd { font: inherit; font-size: 11px; padding: 0 5px; margin-left: 4px; border: 1px solid currentColor; border-radius: 4px; opacity: .75; }
@media (max-width: 700px) { .print-choice .btn { flex: 1 1 100%; } }

/* suggestions under the name field */
.suggest {
  position: fixed; z-index: 20; overflow-y: auto; max-width: calc(100vw - 20px); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(0,0,0,.14); padding: 4px 0;
}
.sg { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 16px; padding: 6px 12px; cursor: pointer; }
.sg.on { background: var(--accent-bg); }
.sg-name { font-weight: 500; }
.sg-name em { font-style: normal; font-size: 12px; color: var(--warn); margin-left: 6px; }
.sg-price { font-variant-numeric: tabular-nums; color: var(--accent); white-space: nowrap; }
.sg-cat { grid-column: 1 / -1; font-size: 12px; color: var(--text-3); }
.sg.sg-col { display: flex; align-items: center; gap: 10px; padding: 7px 12px; }
.sw { display: inline-block; flex: 0 0 auto; width: 22px; height: 22px; border-radius: 5px; border: 1px solid rgba(0,0,0,.25); }
.sw-clear { background: linear-gradient(135deg, rgba(255,255,255,.95), rgba(210,232,245,.7)), repeating-conic-gradient(#e4e4e4 0 25%, #fff 0 50%) 0 0 / 8px 8px; }

@media (max-width: 900px) {
  .bill-head { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .line-head { display: none; }
  .line { grid-template-columns: 22px minmax(0, 1fr) minmax(0, 1fr) 40px; row-gap: 6px; }
  .line [data-f="text"] { grid-column: 2 / 4; }
  .line .btn-del { grid-column: 4; grid-row: 1; }
  .line [data-f="color"] { grid-column: 2 / 4; }
  .line-nocolor { display: none; }
  .line [data-f="qtyRaw"] { grid-column: 2; }
  .line [data-f="uom"] { grid-column: 3; }
  .line [data-f="priceRaw"] { grid-column: 2; }
  .line-sum { grid-column: 3; }
  .suggest .sg { padding: 8px 12px; }
}
@media (max-width: 700px) {
  .bill-main { padding: 10px; gap: 12px; }
  .bill-totals { flex-direction: column; align-items: stretch; }
}

/* ---------- A4 printout: invoice / cashier stub / warehouse card ---------- */
.print-sheet { display: none; }
@media print {
  .page-bill .bill-main, .page-bill .suggest { display: none !important; }
  .print-sheet { display: block; padding: 8mm 10mm; color: #000; font-size: 9.5pt; line-height: 1.3; }
  .print-sheet b { font-weight: 700; }
  .p-zone { overflow: hidden; }
  /* Invoice on the top 2/3, cashier's copy on the bottom 1/3: the tear line is always in the same place. */
  .shared .p-invoice { height: 186mm; }
  .shared .p-cashier { height: 92mm; }
  .p-cashier { padding-top: 3mm; font-size: 8.5pt; }
  .p-cashier .p-table { font-size: 8.5pt; }
  .p-cashier .p-table td { padding: .3mm 1.5mm; }
  .p-cashier .p-total { font-size: 12pt; }
  .p-warehouse { break-before: page; }
  /* Customer invoice */
  .p-invoice { display: flex; flex-direction: column; padding-bottom: 4mm; }
  .p-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 8mm; padding-bottom: 2.5mm; border-bottom: 1.5pt solid #000; }
  .p-logo { display: block; height: 9mm; width: auto; margin-bottom: 1.5mm; }
  .p-seller { font-size: 8.5pt; line-height: 1.4; }
  .p-seller b { font-size: 10pt; }
  .p-doc { text-align: right; white-space: nowrap; }
  .p-doc-title { font-size: 17pt; font-weight: 700; letter-spacing: .3pt; line-height: 1.1; }
  .p-invoice .p-no { font-size: 13pt; margin: 1mm 0 .8mm; }
  .p-buyer { display: flex; gap: 10mm; padding: 2mm 0; border-bottom: .5pt solid #000; }
  .p-label { display: block; font-size: 7.5pt; }
  .p-buyer b { font-size: 10.5pt; }
  .p-invoice .p-table { margin-top: 2mm; font-size: 9.5pt; }
  .p-invoice .p-table th { font-size: 7.5pt; border-bottom: 1pt solid #000; padding: .8mm 1.5mm; }
  .p-invoice .p-table td { padding: 1.3mm 1.5mm; border-bottom: .3pt solid #999; vertical-align: top; font-variant-numeric: tabular-nums; }
  .p-invoice .p-table td:first-child { width: 5mm; }
  .p-invoice .p-table td:last-child { font-weight: 700; }
  .p-color, .p-sub { font-size: 8.5pt; }
  .p-sub { margin-top: .3mm; }
  .p-bottom { margin-top: auto; display: flex; justify-content: space-between; align-items: flex-end; gap: 8mm; padding-top: 3mm; border-top: 1.5pt solid #000; }
  .p-bank-title { font-size: 8.5pt; font-weight: 700; margin-bottom: 1mm; }
  .p-iban-row { display: flex; align-items: baseline; gap: 3mm; margin-top: .8mm; font-size: 8.5pt; }
  .p-invoice .p-bank { font-size: 8.5pt; padding: 1.5mm 3mm 1.8mm; }
  .p-iban-row span { width: 32mm; white-space: nowrap; }
  .p-iban { font-size: 12.5pt; letter-spacing: .4pt; font-variant-numeric: tabular-nums; }
  .p-purpose { font-size: 8.5pt; margin-top: 1.5mm; }
  .p-invoice .p-sum { text-align: right; }
  .p-invoice .p-total { display: block; font-size: 19pt; line-height: 1.15; }
  .p-pay-box { font-size: 9pt; }
  .p-pay-box .p-sign { margin-top: 3mm; }
  .p-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8mm; }
  .p-brand { font-size: 12pt; letter-spacing: .5pt; }
  .p-right { text-align: right; white-space: nowrap; }
  .p-muted { color: #000; font-size: 8pt; }
  .p-no { display: inline-block; border: 1.2pt solid #000; padding: 0 2mm; font-weight: 700; font-size: 11pt; }
  .p-client { margin: 1.5mm 0; }
  .p-table { width: 100%; border-collapse: collapse; margin-top: 1mm; }
  .p-table th { font-weight: 400; font-size: 8pt; text-align: left; border-bottom: .8pt solid #000; padding: .5mm 1.5mm; }
  .p-table td { border-bottom: .3pt solid #777; padding: .6mm 1.5mm; white-space: nowrap; }
  .p-table .r { text-align: right; }
  .p-table .p-name { white-space: normal; width: 100%; }
  .p-foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 6mm; margin-top: 2mm; }
  .p-bank { font-size: 8pt; border: .5pt solid #000; padding: 1mm 2mm; }
  .p-sum { text-align: right; }
  .p-total { font-size: 14pt; }
  .p-tear { border-top: 1pt dashed #000; height: 0; position: relative; }
  .p-tear span { position: absolute; left: 4mm; top: -2.2mm; background: #fff; padding: 0 1.5mm; font-size: 8pt; }
  .p-tear-page { break-before: page; border: 0; }
  .p-tear-page span { display: none; }
  .p-box { display: inline-block; width: 3.2mm; height: 3.2mm; border: .8pt solid #000; vertical-align: -.5mm; margin: 0 1mm 0 2.5mm; }
  /* Warehouse sheet: the cut diagram is the main thing, the pick list stays compact above it. */
  .p-warehouse { font-size: 10pt; }
  .p-wh-title { font-size: 14pt; }
  .p-warehouse .p-no { font-size: 14pt; }
  .p-pick { font-size: 10pt; margin-top: 1.5mm; }
  .p-pick td { padding: .8mm 1.5mm; border-bottom: .5pt solid #000; white-space: normal; }
  .p-pick td:first-child { width: 5mm; }
  .p-pick td:last-child { white-space: nowrap; }
  .p-pick .p-box { width: 3.5mm; height: 3.5mm; margin: 0; }
  .p-pick .p-muted { font-weight: 400; }
  .p-cutnote { margin-top: 1.5mm; }
  .p-wh-foot { display: flex; justify-content: space-between; margin-top: 5mm; font-size: 10pt; }
  .p-plan { margin-top: 4mm; break-inside: avoid; border-top: .8pt solid #000; padding-top: 2mm; }
  .p-plan-title { font-size: 11pt; margin-bottom: 2mm; }
  .p-plan-svg svg { display: block; width: 100%; height: auto; max-height: 175mm; margin: 0 auto; }
  .p-steps { margin: 3mm 0 0; padding-left: 0; list-style: none; font-size: 9pt; line-height: 1.35; columns: 2; column-gap: 6mm; }
  .p-steps li { padding: .6mm 0; border-bottom: .3pt solid #999; break-inside: avoid; }
}
