* { box-sizing: border-box; }
body {
  margin: 0;
  background: #f3f5f8;
  color: #000;
  font-family: Arial, Helvetica, sans-serif;
  border-top: 3px solid #1d4f9a;
}
.page {
  width: min(148mm, 100%);
  min-height: 210mm;
  margin: 0 auto;
  background: #fff;
  padding: 10mm 12mm;
}
.header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  min-width: 0;
}
.logo {
  width: 33mm;
  height: 20mm;
  object-fit: contain;
}
.title {
  padding-bottom: 5mm;
  font-size: 13pt;
  font-weight: 800;
  white-space: nowrap;
}
.details {
  margin-top: 9mm;
  font-size: 10pt;
  line-height: 1.35;
}
.row {
  display: grid;
  grid-template-columns: 34mm 1fr;
  padding: 1.2mm 0;
}
.label,
.device-title {
  font-weight: 800;
}
.value {
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 700;
}
.device {
  padding: 2mm 0;
}
.device-title {
  padding: .5mm 0;
}
.device-row {
  display: grid;
  grid-template-columns: 33mm 1fr;
  line-height: 1.25;
}
.device-label {
  text-align: right;
  font-style: italic;
  font-weight: 800;
}
.device-value {
  padding-left: 2mm;
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 700;
}
.footer {
  margin-top: 6mm;
  border-top: 2px solid #000;
  padding-top: 3mm;
  text-align: center;
  font-size: 8.5pt;
  line-height: 1.35;
  font-weight: 700;
}
.footer .spaced {
  margin-top: 1.5mm;
}
.note {
  margin-top: 2mm;
  font-size: 9pt;
  font-weight: 400;
  line-height: 1.55;
}
.job-detail-page {
  width: 100%;
  max-width: 1560px;
  margin: 0 auto;
  padding: 22px 14px 28px;
  color: #3a3a3a;
}
.job-detail-title {
  margin: 0 0 24px;
  text-align: center;
  font-size: 30px;
  line-height: 1.2;
  font-weight: 800;
}
.job-welcome {
  margin: 0 0 18px;
  font-size: 24px;
  line-height: 1.2;
  font-weight: 800;
}
.job-card {
  margin-bottom: 5px;
  border: 1px solid #b8edf8;
  border-radius: 3px;
  overflow: hidden;
  background: #fff;
}
.job-card-title {
  background: #d9f1fb;
  color: #2f7fa4;
  padding: 12px 15px;
  font-size: 14px;
  line-height: 1.2;
  font-weight: 500;
}
.job-card-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 46px;
  padding: 14px 31px 24px;
  min-height: 101px;
}
.job-card-column {
  min-width: 0;
}
.job-detail-item {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 9px 0;
  min-height: 30px;
}
.job-detail-label {
  font-size: 14px;
  line-height: 1.3;
  font-weight: 800;
}
.job-detail-value {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 14px;
  line-height: 1.35;
  font-weight: 600;
}
.invoice-page {
  display: flex;
  flex-direction: column;
}
.invoice-title {
  margin: 0;
  padding-top: 3mm;
  text-align: center;
  font-size: 18pt;
  font-weight: 800;
}
.invoice-logo-row {
  display: flex;
  justify-content: center;
  margin-bottom: 3mm;
}
.invoice-logo {
  width: 30mm;
  height: 14mm;
  object-fit: contain;
}
.invoice-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 5mm;
  align-items: start;
  margin-top: 8mm;
  font-size: 11pt;
  line-height: 1.45;
}
.invoice-field {
  display: flex;
  gap: 2mm;
  padding: .5mm 0;
  font-weight: 700;
}
.invoice-field-label {
  white-space: nowrap;
}
.invoice-field-value {
  min-width: 0;
  overflow-wrap: anywhere;
}
.invoice-table {
  width: 100%;
  margin-top: 4mm;
  border-collapse: collapse;
  font-size: 11pt;
}
.invoice-table th,
.invoice-table td {
  border: 1px solid #000;
  padding: 2mm;
}
.invoice-table th {
  text-align: center;
  font-weight: 800;
}
.invoice-empty {
  text-align: center;
  font-weight: 700;
}
.col-no { width: 14mm; text-align: center; }
.col-qty { width: 20mm; text-align: center; }
.col-amount { width: 30mm; text-align: right; }
.summary-spacer {
  border-left-color: transparent !important;
  border-bottom-color: transparent !important;
}
.summary-label {
  font-weight: 800;
}
.summary-value {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.signatures {
  display: flex;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 70mm;
  font-size: 11pt;
  font-weight: 700;
}
.signature-line {
  width: 50mm;
  border-top: 1px solid #000;
  padding-top: 2mm;
  text-align: center;
}
.invoice-note {
  margin-top: 8mm;
  text-align: center;
  font-size: 11pt;
  font-weight: 700;
}
.state {
  width: min(560px, calc(100% - 32px));
  margin: 64px auto;
  background: #fff;
  padding: 24px;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .12);
  text-align: center;
}
.state h1 {
  margin: 0 0 8px;
  font-size: 20px;
}
.state p {
  margin: 0;
  color: #475569;
}
@media (max-width: 700px) {
  body { background: #fff; }
  .page {
    min-height: 100svh;
    padding: 40px 16px 24px;
  }
  .header {
    justify-content: center;
    align-items: flex-start;
  }
  .brand {
    align-items: end;
    gap: 20px;
    width: 100%;
  }
  .logo {
    width: 112px;
    height: 52px;
    flex: 0 0 auto;
  }
  .title {
    padding-bottom: 0;
    font-size: 16px;
    line-height: 1.2;
    white-space: nowrap;
  }
  .details {
    margin-top: 16px;
    font-size: 13px;
    line-height: 1.4;
  }
  .row {
    grid-template-columns: 124px minmax(0, 1fr);
    padding: 5px 0;
  }
  .device-row {
    grid-template-columns: 104px minmax(0, 1fr);
    line-height: 1.35;
  }
  .footer {
    margin-top: 18px;
    font-size: 11px;
  }
  .note {
    font-size: 12px;
  }
  .job-detail-page {
    max-width: 520px;
    padding: 20px 14px 24px;
  }
  .job-detail-title {
    margin-bottom: 28px;
    font-size: 30px;
  }
  .job-welcome {
    margin-bottom: 18px;
    font-size: 24px;
  }
  .job-card {
    margin-bottom: 5px;
  }
  .job-card-title {
    padding: 12px 15px;
    font-size: 14px;
  }
  .job-card-body {
    display: block;
    min-height: 0;
    padding: 11px 30px 24px;
  }
  .job-detail-item {
    display: block;
    padding: 12px 0;
  }
  .job-detail-label,
  .job-detail-value {
    display: block;
    font-size: 14px;
  }
  .job-detail-value {
    margin-top: 4px;
  }
  .invoice-title {
    padding-top: 0;
    font-size: 21px;
    line-height: 1.2;
  }
  .invoice-logo-row {
    margin-bottom: 10px;
  }
  .invoice-logo {
    width: 100px;
    height: 46px;
  }
  .invoice-head {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 20px;
    font-size: 13px;
  }
  .invoice-head-left,
  .invoice-head-mid {
    grid-column: 1;
  }
  .invoice-table {
    font-size: 12px;
  }
  .invoice-table th,
  .invoice-table td {
    padding: 7px;
  }
  .col-no { width: 42px; }
  .col-qty { width: 54px; }
  .col-amount { width: 82px; }
  .signatures {
    padding-top: 180px;
    font-size: 12px;
  }
  .signature-line {
    width: 42%;
  }
  .invoice-note {
    font-size: 12px;
  }
}
@media (max-width: 420px) {
  .header {
    gap: 0;
  }
  .brand {
    gap: 10px;
  }
  .logo {
    width: 98px;
    height: 46px;
  }
  .title {
    font-size: 15px;
  }
  .details {
    font-size: 12.5px;
  }
  .row {
    grid-template-columns: 116px minmax(0, 1fr);
  }
  .device-row {
    grid-template-columns: 96px minmax(0, 1fr);
  }
  .device-label {
    text-align: right;
  }
  .invoice-field {
    gap: 5px;
  }
  .invoice-table {
    font-size: 11px;
  }
  .invoice-table th,
  .invoice-table td {
    padding: 6px 4px;
  }
  .col-no { width: 34px; }
  .col-qty { width: 42px; }
  .col-amount { width: 70px; }
}
@media print {
  @page { size: A5 portrait; margin: 0; }
  html, body {
    margin: 0 !important;
    background: #fff;
  }
  body {
    border-top: 0;
  }
  .page {
    width: 148mm;
    min-height: 210mm;
  }
}
