* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #fff4dc;
  color: #33271d;
  font-family: Arial, Helvetica, sans-serif;
}

.header {
  padding: 22px 20px 12px;
  background: #fff8ea;
  text-align: center;
}

.header img {
  max-width: 220px;
  height: auto;
}

.banner {
  width: 100%;
  background: #d94f04;
  border-top: 5px solid #f36c12;
  border-bottom: 8px solid #f3c25a;
  overflow: hidden;
}

.banner img {
  display: block;
  width: 100%;
  height: clamp(150px, 27vw, 340px);
  object-fit: cover;
  object-position: center;
}

.container {
  width: min(720px, calc(100% - 32px));
  margin: 28px auto;
  padding: 28px;
  background: #fffaf0;
  border: 1px solid #edc987;
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(116, 51, 9, 0.14);
}

h2 {
  margin: 0 0 10px;
  font-size: 26px;
  text-align: center;
}

p {
  margin: 0 0 18px;
  color: #7a5a34;
  text-align: center;
}

form {
  display: grid;
  gap: 12px;
}

input {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid #d8b77c;
  border-radius: 6px;
  font-size: 16px;
  text-transform: uppercase;
  background: #ffffff;
  color: #33271d;
}

input:focus {
  border-color: #ef6c00;
  box-shadow: 0 0 0 3px rgba(239, 108, 0, 0.18);
  outline: none;
}

button,
.download-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border: 0;
  border-radius: 6px;
  background: #df5a08;
  color: #ffffff;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

button:hover,
.download-button:hover {
  background: #bd4300;
}

button:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.secondary-button {
  background: #f7dfb3;
  color: #5c340f;
}

.secondary-button:hover {
  background: #efcf92;
}

select {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid #d8b77c;
  border-radius: 6px;
  background: #ffffff;
  color: #33271d;
  font-size: 16px;
}

.secondary-action,
.form-actions {
  margin-top: 18px;
  justify-content: center;
}

.form-grid {
  display: grid;
  gap: 12px;
}

.lookup-status {
  margin: 14px 0;
  padding: 12px 14px;
  border: 1px solid #edc987;
  border-radius: 6px;
  background: #fff7e7;
  color: #7a4b20;
  font-size: 14px;
  text-align: center;
}

.owner-summary {
  display: grid;
  gap: 6px;
  margin: 0 0 16px;
  padding: 14px;
  border-left: 5px solid #df5a08;
  border-radius: 6px;
  background: #fff7e7;
  color: #33271d;
}

.owner-summary span {
  color: #7a5a34;
  font-size: 14px;
}

.documents {
  display: grid;
  gap: 16px;
  margin-top: 22px;
}

.document-group {
  padding: 18px;
  border: 1px solid #edc987;
  border-radius: 8px;
  background: #fff7e7;
}

.document-group h3 {
  margin: 0 0 12px;
  font-size: 18px;
}

.document-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-top: 1px solid #e6ebf0;
}

.document-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.document-row:first-of-type {
  border-top: 0;
}

.document-row span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.muted,
.empty-state {
  margin: 0;
  color: #8b6a45;
  text-align: left;
}

.empty-state {
  padding: 18px;
  border: 1px dashed #d6a45c;
  border-radius: 8px;
  background: #fff7e7;
  text-align: center;
}

.back-link {
  display: inline-block;
  margin-top: 22px;
  color: #c84600;
  font-weight: 700;
  text-decoration: none;
}

.back-link:hover {
  text-decoration: underline;
}

.footer {
  padding: 18px;
  color: #7a4b20;
  text-align: center;
  font-size: 14px;
}

.pdf-page {
  width: 210mm;
  min-height: 297mm;
  margin: 26px auto;
  padding: 18mm 17mm 13mm;
  background: #ffffff;
  color: #111111;
  border: 1px solid #d2c2a0;
  box-shadow: 0 12px 28px rgba(116, 51, 9, 0.14);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 12px;
  line-height: 1.35;
}

.pdf-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
  color: #222222;
}

.pdf-date {
  min-width: 190px;
  text-align: right;
}

.pdf-page h1 {
  margin: 0 0 18px;
  color: #111111;
  font-size: 17px;
  text-align: center;
  text-decoration: underline;
}

.pdf-page h2 {
  margin: 0 0 8px;
  font-size: 13px;
  text-align: left;
}

.pdf-block {
  margin-bottom: 13px;
}

.data-line {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 10px;
  margin-bottom: 3px;
}

.data-line span {
  border-bottom: 1px dotted #999999;
}

.pdf-page ol {
  margin: 0;
  padding-left: 22px;
}

.pdf-table {
  width: 100%;
  border-collapse: collapse;
}

.pdf-table td {
  padding: 3px 0;
  vertical-align: top;
}

.pdf-table td:last-child {
  width: 120px;
  text-align: right;
}

.pdf-totals {
  margin-top: 10px;
  border-top: 1px solid #222222;
  border-bottom: 1px solid #222222;
}

.pdf-totals div {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 6px 0;
}

.signature-area {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 34px;
  align-items: end;
  margin-top: 46px;
}

.stamp {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 118px;
  height: 82px;
  border: 3px double #da5a08;
  border-radius: 50%;
  color: #da5a08;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  transform: rotate(-8deg);
}

.signature-line {
  padding-top: 36px;
  border-top: 1px solid #111111;
  text-align: center;
}

.signature-line span,
.signature-line strong {
  display: block;
}

.purpose {
  margin-top: 32px;
  color: #111111;
  font-weight: 700;
  text-align: center;
}

.pdf-footer {
  margin-top: 12px;
  font-size: 9px;
  text-align: justify;
}

@media (max-width: 560px) {
  .container {
    padding: 22px 18px;
  }

  .document-row {
    grid-template-columns: 1fr;
  }

  .document-actions {
    justify-content: stretch;
  }

  .document-actions .download-button {
    flex: 1 1 140px;
  }
}

@media print {
  @page {
    size: A4;
    margin: 0;
  }

  * {
    box-shadow: none !important;
  }

  html,
  body {
    width: 210mm;
    min-height: 297mm;
    margin: 0;
    background: #ffffff;
  }

  body > * {
    display: none !important;
  }

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

  .pdf-page {
    display: block !important;
    width: 210mm;
    min-height: 297mm;
    margin: 0;
    padding: 14mm 14mm 10mm;
    border: 0;
    box-shadow: none;
    page-break-before: avoid;
    page-break-after: avoid;
  }
}
