.ahms-portal,
.ahms-receipt {
  position: relative;
  margin: 24px auto;
  padding: 22px;
  border: 2px solid #111;
  background: #fff;
  color: #111;
  font-family: "Mangal", Arial, sans-serif;
}

.ahms-portal {
  max-width: 920px;
}

.ahms-receipt {
  width: 210mm;
  min-height: 297mm;
  max-width: none;
  box-sizing: border-box;
  overflow: hidden;
  padding: 10mm;
}

.ahms-receipt-a4 {
  width: 210mm;
  min-height: 297mm;
  padding: 10mm;
  border: 2px solid #111;
  font-size: 11px;
  line-height: 1.25;
}

.ahms-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  border-bottom: 2px solid #111;
  padding-bottom: 12px;
  margin-bottom: 18px;
  text-align: center;
}

.ahms-header img {
  width: 70px;
  height: 70px;
  object-fit: contain;
}

.ahms-header h2 {
  margin: 0;
  font-size: 24px;
}

.ahms-header p {
  margin: 5px 0 0;
}

.ahms-notice,
.ahms-success,
.ahms-error,
.ahms-summary {
  margin: 16px 0;
  padding: 12px;
  border: 1px solid #111;
  background: #f5f5f5;
}

.ahms-error {
  border-color: #b42318;
  color: #b42318;
}

.ahms-success {
  border-color: #176b45;
  color: #176b45;
}

.ahms-lookup {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr) 150px;
  gap: 12px;
  align-items: center;
  margin: 18px 0;
}

.ahms-lookup-four {
  grid-template-columns: 150px minmax(0, 1fr) 150px minmax(0, 1fr) 120px;
}

.ahms-lookup input,
.ahms-field input,
.ahms-field select,
.ahms-field textarea {
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid #111;
  font: inherit;
  box-sizing: border-box;
}

.ahms-form {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 14px;
}

.ahms-summary,
.ahms-declaration,
.ahms-button {
  grid-column: 1 / -1;
}

.ahms-width-full {
  grid-column: span 12;
}

.ahms-width-three_quarter {
  grid-column: span 9;
}

.ahms-width-two_third {
  grid-column: span 8;
}

.ahms-width-half {
  grid-column: span 6;
}

.ahms-width-third {
  grid-column: span 4;
}

.ahms-width-quarter {
  grid-column: span 3;
}

.ahms-field span {
  display: block;
  margin-bottom: 5px;
  font-weight: 700;
}

.ahms-choice-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  min-height: 42px;
  padding: 8px 0;
}

.ahms-choice-group label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ahms-single-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
}

.ahms-form-heading {
  margin: 12px 0 0;
  padding: 8px;
  border: 1px solid #111;
  background: #f1f1f1;
}

.ahms-form-paragraph {
  margin: 0;
  padding: 10px;
  border: 1px solid #ccc;
  background: #fafafa;
}

.ahms-form-divider {
  width: 100%;
  border: 0;
  border-top: 2px solid #111;
}

.ahms-button,
.ahms-lookup button {
  min-height: 46px;
  padding: 10px 22px;
  border: 2px solid #0f3d2e;
  border-radius: 6px;
  background: #176b45;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 0 #0f3d2e;
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.ahms-button:hover,
.ahms-lookup button:hover,
.ahms-button:focus,
.ahms-lookup button:focus {
  background: #0f5a38;
  cursor: pointer;
  transform: translateY(-1px);
  box-shadow: 0 4px 0 #0f3d2e;
}

.ahms-button:active,
.ahms-lookup button:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 #0f3d2e;
}

.ahms-receipt-fields {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 3mm;
  align-items: stretch;
}

.ahms-receipt-item {
  display: grid;
  grid-template-columns: minmax(26mm, 36%) minmax(0, 1fr);
  border: 1px solid #111;
  min-height: 9mm;
}

.ahms-receipt-item strong,
.ahms-receipt-item span {
  padding: 2mm;
}

.ahms-receipt-item strong {
  border-right: 1px solid #111;
  background: #f5f5f5;
}

.ahms-receipt-item span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.ahms-receipt-file {
  display: block;
  max-width: 140px;
  max-height: 160px;
  margin-top: 8px;
  border: 1px solid #111;
  object-fit: contain;
}

.ahms-placed-media {
  position: absolute;
  border: 1px solid #111;
  object-fit: contain;
  background: #fff;
  z-index: 2;
}

.ahms-receipt-fields {
  position: relative;
  z-index: 1;
}

.ahms-receipt-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4mm;
  padding-bottom: 3mm;
  border-bottom: 2px solid #111;
  text-align: center;
}

.ahms-receipt-title img {
  width: 16mm;
  height: 16mm;
  object-fit: contain;
}

.ahms-receipt-title h2 {
  margin: 0;
  font-size: 18px;
}

.ahms-receipt-title p {
  margin: 1mm 0 0;
  font-weight: 700;
}

.ahms-receipt-strip {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  border-left: 1px solid #111;
  border-top: 1px solid #111;
  margin-top: 3mm;
}

.ahms-receipt-strip div {
  display: grid;
  grid-template-columns: 26mm minmax(0, 1fr);
  min-height: 9mm;
  border-right: 1px solid #111;
  border-bottom: 1px solid #111;
}

.ahms-receipt-strip strong,
.ahms-receipt-strip span {
  padding: 2mm;
  overflow-wrap: anywhere;
}

.ahms-receipt-strip strong {
  border-right: 1px solid #111;
  background: #f5f5f5;
}

.ahms-receipt-main {
  display: block;
  width: 100%;
  margin-top: 4mm;
}

.ahms-receipt-top-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32mm;
  gap: 4mm;
  align-items: start;
  margin-bottom: 4mm;
}

.ahms-receipt-top-row > .ahms-receipt-section {
  height: 56mm;
  margin-bottom: 0;
}

.ahms-receipt-top-row > .ahms-receipt-section .ahms-receipt-fields {
  height: calc(100% - 9mm);
  align-content: stretch;
}

.ahms-receipt-top-row > .ahms-receipt-section .ahms-receipt-item {
  min-height: 18mm;
}

.ahms-receipt-section {
  margin-bottom: 4mm;
  border: 1px solid #111;
}

.ahms-receipt-section h3 {
  margin: 0;
  padding: 2mm;
  border-bottom: 1px solid #111;
  background: #f5f5f5;
  font-size: 12px;
}

.ahms-receipt-section .ahms-receipt-fields {
  padding: 3mm;
}

.ahms-receipt-side {
  display: grid;
  align-content: start;
  gap: 4mm;
}

.ahms-receipt-application-section {
  display: block;
  width: 100%;
  clear: both;
  grid-column: 1 / -1;
}

.ahms-receipt-photo-box,
.ahms-receipt-sign-box {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #111;
  background: #fff;
  text-align: center;
  font-weight: 700;
  overflow: hidden;
}

.ahms-receipt-photo-box {
  width: 30mm;
  height: 38mm;
}

.ahms-receipt-sign-box {
  width: 30mm;
  height: 14mm;
}

.ahms-receipt-photo-box img,
.ahms-receipt-sign-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

@media (max-width: 720px) {
  .ahms-lookup,
  .ahms-lookup-four,
  .ahms-form,
  .ahms-receipt-fields {
    grid-template-columns: 1fr;
  }

  .ahms-width-full,
  .ahms-width-three_quarter,
  .ahms-width-two_third,
  .ahms-width-half,
  .ahms-width-third,
  .ahms-width-quarter {
    grid-column: 1 / -1;
  }
}

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

  html,
  body {
    margin: 0 !important;
    padding: 0 !important;
    width: 210mm;
    height: 297mm;
    background: #fff;
  }

  body * {
    visibility: hidden;
  }

  .ahms-receipt,
  .ahms-receipt * {
    visibility: visible;
  }

  #receipt,
  .ahms-receipt {
    position: absolute;
    top: var(--ahms-print-top, 0mm);
    left: var(--ahms-print-left, 0mm);
    width: var(--ahms-print-width, 210mm) !important;
    min-height: var(--ahms-print-height, 297mm) !important;
    height: var(--ahms-print-height, 297mm);
    max-width: none;
    box-sizing: border-box;
    border: 2px solid #111;
    margin: 0 !important;
    padding: var(--ahms-print-padding, 0mm);
    page-break-after: avoid;
    page-break-inside: avoid;
    overflow: hidden;
    font-size: 12px;
    line-height: 1.22;
    transform: scale(var(--ahms-print-scale, 1));
    transform-origin: top left;
    zoom: 1 !important;
    background: #fff;
  }

  .ahms-lookup,
  .ahms-button,
  .ahms-notice,
  .ahms-success,
  .ahms-error {
    display: none;
  }

  .ahms-form,
  .ahms-receipt-fields {
    gap: 2.4mm;
  }

  .ahms-field input,
  .ahms-field select,
  .ahms-field textarea,
  .ahms-receipt-item {
    min-height: 10mm;
  }

  .ahms-header h2 {
    font-size: 18pt;
  }

  .ahms-receipt-title h2 {
    font-size: 20px;
  }

  .ahms-receipt-main {
    display: block !important;
    width: 100% !important;
  }

  .ahms-receipt-top-row {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 31mm;
    gap: 2.5mm;
    margin-bottom: 2.5mm;
  }

  .ahms-receipt-application-section {
    display: block !important;
    width: 100% !important;
    clear: both !important;
    grid-column: 1 / -1 !important;
  }

  .ahms-receipt-top-row > .ahms-receipt-section {
    height: 52mm;
  }

  .ahms-receipt-top-row > .ahms-receipt-section .ahms-receipt-item {
    min-height: 16mm;
  }

  .ahms-receipt-photo-box {
    width: 30mm;
    height: 38mm;
  }

  .ahms-receipt-sign-box {
    width: 30mm;
    height: 13mm;
  }

  .ahms-receipt-section {
    margin-bottom: 3mm;
  }

  .ahms-receipt-section .ahms-receipt-fields {
    padding: 2mm;
  }
}
