.paperLogo {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-start;
}

.paperMini {
  max-width: 340px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.paperMini select,
.paperBoxHead select {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #fff;
  color: #344054;
  padding: 6px;
  font-weight: 700;
}

.paperBoxHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.paperBoxHead select {
  max-width: 170px;
}

.paperDocType {
  max-width: 100%;
  border: 0;
  background: transparent;
  color: var(--blue);
  font-size: 38px;
  font-weight: 900;
  letter-spacing: 2px;
  text-align: right;
  appearance: none;
}

.paperNo {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 4px 0;
  text-align: right;
  font-size: 21px;
  font-weight: 900;
}

.paperStatus {
  margin-top: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #eef4ff;
  color: var(--blue);
  padding: 7px 10px;
  font-weight: 900;
}

.paperEdit,
.paperDate,
.paperNote,
.paperStamp {
  min-width: 0;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  padding: 3px 5px;
}

.paperEdit {
  display: block;
  width: 100%;
  line-height: 1.35;
}

.paperEdit.strong {
  font-weight: 900;
}

.paperEdit:hover,
.paperDate:hover,
.paperNote:hover,
.paperStamp:hover,
.paperDocType:hover,
.paperNo:hover,
.paperStatus:hover,
.paperMini select:hover,
.paperBoxHead select:hover {
  border-color: #d0d5dd;
  background: #f8fafc;
}

.paperEdit:focus,
.paperDate:focus,
.paperNote:focus,
.paperStamp:focus,
.paperDocType:focus,
.paperNo:focus,
.paperStatus:focus,
.paperMini select:focus,
.paperBoxHead select:focus {
  border-color: var(--blue);
  outline: 2px solid rgba(11, 107, 255, .18);
  background: #fff;
}

.paperInline {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 6px;
}

.paperLine {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 2px 0;
}

.paperLine b {
  white-space: nowrap;
}

.paperLine span {
  padding: 3px 5px;
}

.datebar label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.paperDate {
  font-weight: 900;
}

.bank .paperLine {
  max-width: 680px;
}

.paperNote {
  width: 100%;
  min-height: 54px;
  margin-top: 24px;
  color: #475467;
  resize: vertical;
}

.paperStamp {
  width: 230px;
  min-height: 92px;
  text-align: center;
  resize: vertical;
}

.paperStampImage {
  display: block;
  width: 230px;
  max-width: 100%;
  max-height: 110px;
  object-fit: contain;
  object-position: center;
}

.paperStampBox {
  display: flex;
  min-width: 270px;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.paperStampBox small {
  color: #475467;
  font-size: 12px;
  font-weight: 800;
}

.stampUpload {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid #e6eaf0;
  border-radius: 12px;
  background: #f8fafc;
}

.stampUpload input[type="file"] {
  display: none;
}

.stampPreview {
  display: inline-flex;
  width: fit-content;
  max-width: 360px;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px;
  border: 1px solid #dbe3ef;
  border-radius: 10px;
  background: #fff;
}

.stampPreview img {
  max-width: 300px;
  max-height: 120px;
  object-fit: contain;
}

.stampSizeControl {
  display: grid;
  gap: 8px;
  color: #344054;
  font-size: 13px;
  font-weight: 800;
}

.stampSizeControl span {
  color: var(--blue);
}

.stampSizeControl input {
  width: 100%;
}

.stampPreview small,
.stampEmpty {
  color: #667085;
  font-size: 12px;
  font-weight: 700;
}

.sign .paperLine {
  min-width: 270px;
}

.invoiceTemplate {
  color: #111827;
}

.invoiceTemplate .paperTop {
  border-bottom: 0;
  align-items: flex-start;
  padding-bottom: 12px;
}

.invoiceTemplate .paperLogo img {
  height: 56px;
}

.invoiceTemplate .paperTitle {
  min-width: 310px;
}

.invoiceTemplate .amountDue {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  align-items: baseline;
  margin-bottom: 10px;
  color: #111827;
}

.invoiceTemplate .amountDue span {
  color: #475467;
  font-weight: 800;
}

.invoiceTemplate .amountDue b {
  font-size: 24px;
  font-weight: 900;
}

.invoiceTemplate .paperDocType {
  color: #111827;
  font-size: 36px;
  text-transform: uppercase;
}

.invoiceTemplate .paperNo {
  color: #111827;
}

.invoiceTemplate .paperCols {
  margin: 24px 0 18px;
}

.invoiceTemplate .boxTitle {
  background: transparent;
  border-bottom: 1px solid #d0d5dd;
  border-radius: 0;
  color: #111827;
  padding: 0 0 8px;
  letter-spacing: 2px;
}

.invoiceTemplate .paperIds {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 16px;
}

.invoiceTemplate .paperIds label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 800;
}

.invoiceTemplate .paperIds .paperEdit {
  width: 115px;
}

.invoiceTemplate .datebar {
  border-top: 1px solid #d0d5dd;
  border-bottom: 1px solid #d0d5dd;
  border-radius: 0;
  background: transparent;
}

.invoiceTemplate .compactBank {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 12px;
  margin: 18px 0;
}

.invoiceTemplate .compactBank label {
  display: contents;
}

.invoiceTemplate .compactBank b {
  white-space: nowrap;
}

.invoiceTemplate .compactBank span,
.invoiceTemplate .compactBank input {
  width: 100%;
}

.invoiceTemplate .invoiceIntro {
  margin: 20px 0 10px;
}

.invoiceTemplate .paperTable th {
  background: transparent;
  border-bottom: 2px solid #d0d5dd;
  color: #667085;
}

.invoiceTemplate .paperTable td {
  border-bottom: 1px solid #e6eaf0;
}

.invoiceTemplate .amountTotal {
  display: flex;
  justify-content: flex-end;
  gap: 14px;
  align-items: baseline;
  margin: 22px 0 16px;
  text-align: right;
}

.invoiceTemplate .amountTotal span {
  color: #475467;
  font-weight: 900;
}

.invoiceTemplate .amountTotal b {
  background: transparent;
  color: #111827;
  padding: 0;
  font-size: 28px;
}

.invoiceTemplate .depositLine {
  margin: 16px 0 0;
}

.invoiceTemplate .paymentSection {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: start;
  margin: 18px 0;
}

.invoiceTemplate .paymentSection .compactBank {
  margin: 0;
}

.paymentQr {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.paymentQr .qrSvg {
  display: block;
  border: 1px solid #e6eaf0;
  border-radius: 6px;
  padding: 6px;
  background: #fff;
}

.paymentQr small {
  color: #475467;
  font-size: 12px;
  font-weight: 800;
}

.paymentQr.qrError {
  max-width: 150px;
  padding: 10px;
  border: 1px dashed #d0d5dd;
  border-radius: 8px;
  text-align: center;
}

.qrModeSelect {
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid #dbe3ef;
  border-radius: 12px;
  background: #fff;
  color: #0f172a;
  font-weight: 800;
}

@media (max-width: 680px) {
  .paperDocType {
    font-size: 30px;
    text-align: left;
  }

  .paperNo {
    text-align: left;
  }

  .invoiceTemplate .paymentSection {
    grid-template-columns: 1fr;
  }

  .paymentQr {
    align-items: flex-start;
  }
}

@media print {
  @page {
    size: A4;
    margin: 8mm;
  }

  html,
  body {
    width: 210mm;
    min-height: 297mm;
  }

  body {
    font-size: 11px;
    line-height: 1.25;
  }

  .content {
    padding: 0 !important;
    max-width: none !important;
  }

  .paper {
    width: 100% !important;
    max-width: none !important;
    padding: 10mm 11mm !important;
    border-radius: 0 !important;
  }

  .paperTop {
    gap: 10mm;
    padding-bottom: 8px;
    border-bottom-width: 3px;
  }

  .paperLogo img {
    height: 42px !important;
    max-width: 190px !important;
  }

  .paperMini,
  .paperStatus,
  .paperBoxHead select {
    display: none !important;
  }

  .paperDocType {
    font-size: 26px;
    line-height: 1.05;
  }

  .paperNo {
    font-size: 15px;
    line-height: 1.15;
  }

  .paperCols {
    gap: 14px;
    margin: 12px 0;
  }

  .boxTitle {
    margin-bottom: 6px;
    padding: 6px 8px;
    font-size: 12px;
    letter-spacing: 2px;
  }

  .paperEdit,
  .paperDate,
  .paperNote,
  .paperStamp,
  .paperDocType,
  .paperNo {
    padding: 0 !important;
    -webkit-appearance: none;
    appearance: none;
  }

  .paperInline {
    grid-template-columns: 58px 1fr;
    gap: 4px;
  }

  .datebar {
    margin: 10px 0 !important;
    padding: 8px 10px !important;
  }

  .datebar label {
    gap: 6px;
  }

  .bank {
    margin: 8px 0 10px;
    line-height: 1.2;
  }

  .bank .paperLine {
    max-width: none;
    margin: 0 0 3px;
    gap: 5px;
  }

  .bank .paperEdit {
    width: auto;
    flex: 1;
  }

  .paperTable {
    margin-top: 8px !important;
    font-size: 10.5px;
  }

  .paperTable th {
    padding: 5px 7px !important;
  }

  .paperTable td {
    padding: 4px 7px !important;
  }

  .paperTable input,
  .paperTable textarea,
  .paperTable select {
    padding: 0 !important;
    min-height: 0 !important;
  }

  .totalBox {
    margin: 10px 0 !important;
  }

  .totalBox b {
    padding: 8px 12px !important;
    font-size: 16px !important;
  }

  .paperNote {
    min-height: 30px;
    margin-top: 10px;
    resize: none;
  }

  .sign {
    margin-top: 18px !important;
  }

  .paperStamp {
    width: 170px;
    min-height: 58px;
    resize: none;
  }

  .paperStampImage {
    width: 170px;
    max-height: 70px;
  }

  .sign .paperLine {
    min-width: 210px;
  }

  .paperTop,
  .paperCols,
  .datebar,
  .bank,
  .paymentSection,
  .paymentQr,
  .paperTable,
  .totalBox,
  .sign {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .paperEdit,
  .paperDate,
  .paperNote,
  .paperStamp,
  .paperDocType,
  .paperNo,
  .paperStatus,
  .paperMini select,
  .paperBoxHead select {
    border-color: transparent !important;
    background: transparent !important;
    outline: 0 !important;
    box-shadow: none !important;
  }

  .paymentQr .qrSvg {
    border: 0;
    padding: 0;
  }

  .paymentQr small {
    font-size: 10px;
  }
}
