@import url('https://fonts.googleapis.com/css2?family=Arial:wght@400;700&display=swap');

:root {
  --border-color: #000;
  --bg-color: #e5e7eb;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-color);
  font-family: Arial, sans-serif;
  color: #000;
  font-size: 13px;
  line-height: 1;
}

/* ══════════════════════════════════════
   TOOLBAR (Screen only)
══════════════════════════════════════ */
.toolbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #fff;
  border-bottom: 1px solid #ccc;
  padding: 10px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.toolbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: bold;
  color: #333;
}

.toolbar-right {
  display: flex;
  gap: 10px;
}

.tbtn {
  padding: 6px 12px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.tbtn:hover {
  background: #f9f9f9;
}

.tbtn-blue {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
}

.tbtn-blue:hover {
  background: #1d4ed8;
}

/* ══════════════════════════════════════
   PAPER WRAPPER
══════════════════════════════════════ */
.page-wrap {
  padding: 30px;
  display: flex;
  justify-content: center;
}

.form-paper {
  background: #fff;
  width: 21cm;
  /* A4 Landscape Width */
  min-height: 29.7cm;
  /* A4 Landscape Height */
  padding: 20px 20px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
}

/* ── HEADER ── */
.header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.logo-left,
.logo-right {
  width: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: bold;
  color: #000;
}

.logo-svg {
  width: 80px;
  height: auto;
}

.header-center {
  flex: 1;
  text-align: center;
  padding: 0 10px;
}

.auth-dealer {
  font-size: 11px;
  background: #f0f0f0;
  padding: 2px 10px;
  display: inline-block;
  margin-bottom: 5px;
  border: 1px solid #ccc;
}

.company-name {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 24px;
  font-weight: bold;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.company-name .red-logo {
  width: 24px;
  height: 24px;
  background: red;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.company-details {
  font-size: 10px;
  line-height: 1.2;
}

.header-right-box {
  width: 220px;
}

.hdr-tbl {
  width: 100%;
  border-collapse: collapse;
}

.hdr-tbl td {
  border: 1px solid #000;
  padding: 4px 8px;
  height: 26px;
}

.hdr-tbl td.lbl {
  width: 100px;
}

.hdr-tbl input {
  width: 100%;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 13px;
}

/* ── SUBHEADER: NPWP & TITLE ── */
.subheader-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 5px;
}

.npwp {
  font-size: 12px;
}

.doc-title {
  padding-bottom: 28px;
  font-size: 16px;
  font-weight: bold;
  text-decoration: underline;
  padding-right: 50px;
  flex: 1;
  text-align: center;
}

/* ── CUSTOMER INFO ── */
.cust-tbl {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 2px;
}

.cust-tbl td {
  border: 1px solid #000;
  padding: 2px 8px;
  height: 24px;
  vertical-align: middle;
}

.cust-tbl td.lbl {
  width: 190px;
}

.cust-tbl input {
  width: 100%;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 13px;
  background: transparent;
}

.cust-tbl .tel-lbl {
  width: 20px;
  border-left: 1px solid #000;
  border-right: none;
}

.cust-tbl .tel-val {
  border-left: none;
  width: 230px;
}

/* ── ITEMS TABLE ── */
.items-tbl {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: -1px;
}

.items-tbl th,
.items-tbl td {
  border: 1px solid #000;
  padding: 4px 8px;
  text-align: center;
  vertical-align: middle;
}

.items-tbl th {
  background: #fff;
  font-weight: normal;
  height: 28px;
}

.items-tbl td {
  /* height: 24px; */
}

.col-no {
  width: 50px;
}

.col-nobrg {
  width: 140px;
}

.col-nama {
  width: auto;
  text-align: left !important;
}

.col-qty {
  width: 60px;
}

.col-harga {
  width: 110px;
  text-align: right !important;
}

.col-jml {
  width: 110px;
  text-align: right !important;
}

.items-tbl input {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  font-family: inherit;
  font-size: 13px;
}

.items-tbl input.center {
  text-align: center;
}

.items-tbl input.right {
  text-align: right;
}

/* ── FOOTER: NOTES & TOTAL ── */
.footer-container {
  display: flex;
  border: 1px solid #000;
  border-top: none;
}

.notes-sec {
  flex: 1;
  padding: 4px 8px;
  font-size: 11px;
  border-right: 1px solid #000;
  width: 200px !important;
}

.notes-sec p {
  margin-bottom: 2px;
}

.notes-sec ol {
  padding-left: 15px;
  margin: 0;
}

.notes-sec li {
  margin-bottom: 2px;
}

.total-sec {
  /* width: 388px; */
  /* sum of qty+harga+jml roughly if needed, we'll let flex handle it */
}

.tot-tbl {
  width: 100%;
  border-collapse: collapse;
}

.tot-tbl td {
  border-bottom: 1px solid #000;
  padding: 2px 10px;
  /* height: 26px; */
}

.tot-tbl tr:last-child td {
  border-bottom: none;
}

.tot-tbl td.lbl {
  /* 60+120=180px usually but we can fix to align */
  width: 169px;
}

.tot-tbl td.val {
  border-left: 1px solid #000;
  width: 110px;
}

.tot-tbl input {
  width: 100%;
  border: none;
  outline: none;
  text-align: right;
  font-family: inherit;
  font-size: 13px;
  font-weight: bold;
}

/* ── SIGNATURES ── */
.signatures {
  display: flex;
  justify-content: space-between;
  margin-top: 15px;
  padding: 0 80px;
}

.sig-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 200px;
}

.sig-box .role {
  margin-bottom: 25px;
  /* Kurangi agar tidak terlalu memakan tinggi kertas */
  font-size: 13px;
}

.sig-box .name-line {
  display: flex;
  align-items: center;
  width: 100%;
}

.sig-box .name-line span {
  font-size: 13px;
}

.sig-box .name-input {
  flex: 1;
  border: none;
  border-bottom: 1px solid #000;
  outline: none;
  text-align: center;
  font-size: 13px;
  margin: 0 5px;
}

/* ══════════════════════════════════════
   PRINT STYLES
══════════════════════════════════════ */
@media print {

  .no-print,
  .toolbar {
    display: none !important;
  }

  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  html,
  body {
    margin: 0 !important;
    padding: 10px 15px !important;
    background: #fff !important;
    width: 100% !important;
  }

  .page-wrap {
    padding: 0 !important;
    margin: 0 !important;
  }

  .form-paper {
    box-shadow: none !important;
    /* Ubah padding di bawah ini untuk menggeser posisi teks saat diprint (Kalibrasi) */
    padding-top: 0px !important;
    padding-left: 0px !important;
    padding-right: 0px !important;
    margin: 0 !important;
    width: 100% !important;
    visibility: hidden;
  }

  input {
    visibility: visible;
    color: #000 !important;
    background: transparent !important;
    border: none !important;
    padding: 0px !important;
    /* Hilangkan padding input agar nge-pas */
  }

  /* Mengurangi gap antar baris khusus untuk print agar muat 1 lembar (165mm) */
  .header-row {
    margin-bottom: 2px !important;
  }

  .signatures {
    margin-top: 2px !important;
  }

  .sig-box .role {
    margin-bottom: 20px !important;
  }

  /* Kurangi padding di tabel agar tidak terlalu tinggi saat diprint */
  .items-tbl td,
  .items-tbl th,
  .cust-tbl td,
  .tot-tbl td {
    padding: 2px 4px !important;
  }

  @page {
    margin: 0mm;
    size: A4 portrait;
  }
}