.purchase-receipts-page {
  display: block;
}

.purchase-receipts-shell {
  width: 100%;
}

.purchase-receipts-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.purchase-receipts-header p {
  margin: 0 0 4px;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.purchase-receipts-header h2 {
  margin: 0;
}

.purchase-receipts-header small {
  color: #64748b;
}

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

.purchase-receipts-header-right {
  align-items: flex-end;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: min(560px, 48%);
}

.purchase-receipts-top-summary {
  border-bottom: 1px solid var(--planner-border, #e2e8f0);
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, minmax(96px, 1fr));
  justify-items: end;
  padding-bottom: 8px;
  width: 100%;
}

.purchase-receipts-top-summary div {
  min-width: 0;
  text-align: right;
}

.purchase-receipts-top-summary span {
  color: var(--planner-muted, #64748b);
  display: block;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.purchase-receipts-top-summary strong {
  color: var(--planner-on-light, #0f172a);
  display: block;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  margin-top: 2px;
  white-space: nowrap;
}

.purchase-receipts-catalog-message {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  color: #9a3412;
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 12px;
  padding: 10px 12px;
}

.purchase-receipts-filters,
.purchase-receipts-general,
.purchase-receipts-commercial {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.purchase-receipts-general {
  grid-template-columns: repeat(5, minmax(150px, 1fr));
}

.purchase-receipts-commercial {
  border-top: 1px solid #e2e8f0;
  grid-template-columns: minmax(180px, 25fr) minmax(240px, 35fr) minmax(120px, 15fr) minmax(0, 25fr);
  padding-top: 14px;
}

.purchase-receipts-commercial .purchase-receipts-section-title {
  grid-column: 1 / -1;
  margin-bottom: 0;
}

.purchase-receipts-notes-field {
  grid-column: span 2;
}

.purchase-receipts-notes-row {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 16px;
}

.purchase-receipts-notes-row .planner-field {
  display: block;
}

.purchase-receipts-notes-row textarea {
  max-height: 180px;
  min-height: 82px;
  resize: vertical;
  width: 100%;
}

.purchase-receipts-origin {
  margin: 16px 0;
}

.purchase-receipts-linked-origin,
.purchase-receipts-source-document {
  margin: 14px 0;
}

.purchase-receipts-origin > div > span,
.purchase-receipts-linked-origin > div > span {
  display: block;
  margin-bottom: 8px;
  color: #334155;
  font-weight: 700;
}

.purchase-receipts-segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.purchase-receipts-segmented button {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: #334155;
  cursor: pointer;
  padding: 9px 12px;
  text-align: left;
}

.purchase-receipts-segmented button.active {
  border-color: #1e2945;
  background: #1e2945;
  color: #ffffff;
}

.purchase-receipts-segmented button:disabled {
  background: #f8fafc;
  color: #94a3b8;
  cursor: not-allowed;
}

.purchase-receipts-segmented small {
  display: block;
  font-size: 11px;
}

.purchase-receipts-source-document {
  display: grid;
  grid-template-columns: minmax(280px, 420px) 1fr;
  gap: 14px;
  align-items: end;
  border-top: 1px solid #e2e8f0;
  border-bottom: 1px solid #e2e8f0;
  padding: 14px 0;
}

.purchase-receipts-source-summary {
  color: #475569;
  font-size: 13px;
}

.purchase-receipts-source-summary dl {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 10px;
  margin: 0;
}

.purchase-receipts-source-summary div {
  min-width: 0;
}

.purchase-receipts-source-summary dt {
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.purchase-receipts-source-summary dd {
  margin: 2px 0 0;
  color: #1e293b;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.purchase-receipts-xml-error {
  color: #b91c1c;
  font-weight: 800;
}

.purchase-receipts-xml-block-title,
.purchase-receipts-xml-physical-heading {
  color: #1e293b;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.purchase-receipts-xml-block-title {
  margin-bottom: 10px;
}

.purchase-receipts-xml-physical-heading {
  border-bottom: 1px solid #e2e8f0;
  margin: 16px 0 12px;
  padding-bottom: 8px;
}

.purchase-receipts-xml-assistant-state {
  align-items: center;
  border-top: 1px solid #e2e8f0;
  color: #475569;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 800;
  margin-top: 10px;
  padding-top: 10px;
}

.purchase-receipts-xml-inline-status {
  color: #8a5a00;
  display: block;
  font-size: 11px;
  font-weight: 700;
  min-height: 16px;
  padding-top: 4px;
}

.purchase-receipts-inherited-conditions {
  border-bottom: 1px solid #e2e8f0;
  margin: 0 0 16px;
  padding: 0 0 14px;
}

.purchase-receipts-inherited-conditions dl {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 10px;
  margin: 0;
}

.purchase-receipts-inherited-conditions div {
  min-width: 0;
}

.purchase-receipts-inherited-conditions dt {
  color: #475569;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.purchase-receipts-inherited-conditions dd {
  margin: 2px 0 0;
  color: #0f172a;
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.purchase-receipts-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.purchase-receipts-section-title h3 {
  margin: 0;
}

.purchase-receipts-section-help {
  color: #64748b;
  font-size: 12px;
  margin: 3px 0 0;
}

.purchase-receipts-item-capture {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  margin: 0 0 16px;
  padding: 14px;
}

.purchase-receipts-item-capture-heading,
.purchase-receipts-added-items-heading {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.purchase-receipts-item-capture-heading h4,
.purchase-receipts-added-items-heading h4 {
  color: #0f172a;
  font-size: 14px;
  margin: 0;
}

.purchase-receipts-item-capture-heading p {
  color: #64748b;
  font-size: 12px;
  margin: 3px 0 0;
}

.purchase-receipts-item-capture-status,
.purchase-receipts-added-items-heading span {
  color: #475569;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.purchase-receipts-item-capture-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  margin-top: 12px;
}

.purchase-receipts-item-capture-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.purchase-receipts-added-items-heading {
  border-bottom: 1px solid #e2e8f0;
  margin: 18px 0 10px;
  padding-bottom: 8px;
}

.purchase-receipts-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.purchase-receipts-global-grid-header,
.purchase-receipts-global-grid-row {
  min-width: 1230px;
}

.purchase-receipts-global-grid-header > div,
.purchase-receipts-global-grid-row > div {
  min-width: 0;
  overflow: hidden;
  padding: 8px 7px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.purchase-receipts-global-grid-row {
  border-bottom: 1px solid #e2e8f0;
}

.purchase-receipts-global-grid-row strong {
  font-weight: 900;
}

.purchase-receipts-total-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(170px, 1fr));
  gap: 8px;
  min-width: 760px;
  margin: 0 0 10px;
  font-size: 11px;
}

.purchase-receipts-total-summary > div {
  border: 1px solid #e5e9f2;
  background: #f8fafc;
  border-radius: 6px;
  padding: 8px;
}

.purchase-receipts-total-summary span {
  display: block;
  color: #64748b;
  font-weight: 800;
}

.purchase-receipts-total-summary strong {
  display: block;
  margin-top: 3px;
  color: #0f172a;
  font-size: 12px;
  font-weight: 900;
}

.purchase-receipts-table {
  width: 100%;
  min-width: 1280px;
  border-collapse: collapse;
  table-layout: fixed;
}

.purchase-receipts-table th,
.purchase-receipts-table td {
  border-bottom: 1px solid #e2e8f0;
  padding: 8px 7px;
  text-align: left;
  vertical-align: middle;
}

.purchase-receipts-table th {
  background: #f8fafc;
  color: #1e293b;
  font-size: 12.5px;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
}

.purchase-receipts-table input,
.purchase-receipts-table select {
  width: 100%;
  min-width: 0;
}

.purchase-receipts-products .pr-col-sku {
  width: 10%;
}

.purchase-receipts-products .pr-col-product {
  width: 20%;
}

.purchase-receipts-products .pr-col-warehouse,
.purchase-receipts-products .pr-col-lot {
  width: 10%;
}

.purchase-receipts-products .pr-col-unit {
  width: 8%;
}

.purchase-receipts-products .pr-col-quantity {
  width: 7%;
}

.purchase-receipts-products .pr-col-unit-cost {
  width: 10%;
}

.purchase-receipts-products .pr-col-discount {
  width: 8%;
}

.purchase-receipts-products .pr-col-tax {
  width: 8%;
}

.purchase-receipts-products .pr-col-amount {
  width: 9%;
}

.purchase-receipts-products .pr-col-actions {
  width: 3%;
}

.purchase-receipts-sku-cell,
.purchase-receipts-unit-cell {
  color: #475569;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.purchase-receipts-context-cell {
  color: #334155;
  font-size: 12px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.purchase-receipts-product-cell > span,
.purchase-receipts-table td > span {
  color: #334155;
  font-size: 12px;
  font-weight: 700;
}

.purchase-receipts-sku-input,
.purchase-receipts-unit-select {
  height: 34px;
  padding: 6px 8px;
}

.purchase-receipts-unit-missing {
  color: #991b1b;
  font-size: 11.5px;
  font-weight: 800;
  white-space: normal;
}

.purchase-receipts-xml-line-meta {
  display: block;
  margin-top: 4px;
  color: #64748b;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.25;
}

.purchase-receipts-xml-item-row > td {
  background: #ffffff;
  padding: 10px 0;
}

.purchase-receipts-xml-item {
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  overflow: hidden;
}

.purchase-receipts-xml-item-header {
  align-items: center;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
}

.purchase-receipts-xml-item-header strong {
  color: #0f172a;
  font-size: 13px;
}

.purchase-receipts-xml-item-header span {
  color: #475569;
  font-size: 12px;
  font-weight: 800;
}

.purchase-receipts-xml-flow {
  display: grid;
  grid-template-columns: minmax(260px, 1.2fr) minmax(240px, 1fr) minmax(240px, 1fr);
}

.purchase-receipts-xml-flow section {
  border-right: 1px solid #e2e8f0;
  padding: 12px;
  min-width: 0;
}

.purchase-receipts-xml-flow section:last-child {
  border-right: 0;
}

.purchase-receipts-xml-flow h4 {
  color: #334155;
  font-size: 12px;
  font-weight: 900;
  margin: 0 0 9px;
  text-transform: uppercase;
}

.purchase-receipts-xml-fiscal-grid,
.purchase-receipts-xml-quantity-grid {
  display: grid;
  gap: 9px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
}

.purchase-receipts-xml-fiscal-grid .wide {
  grid-column: 1 / -1;
}

.purchase-receipts-xml-fiscal-grid dt,
.purchase-receipts-xml-unit-pair span,
.purchase-receipts-xml-quantity-grid label,
.purchase-receipts-xml-product-tools label {
  color: #64748b;
  font-size: 11px;
  font-weight: 800;
}

.purchase-receipts-xml-fiscal-grid dd {
  color: #0f172a;
  font-size: 12px;
  font-weight: 800;
  margin: 2px 0 0;
  overflow-wrap: anywhere;
}

.purchase-receipts-xml-tax span {
  display: block;
}

.purchase-receipts-xml-match {
  border: 1px solid #dbe3ef;
  border-radius: 6px;
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
  padding: 9px;
}

.purchase-receipts-xml-match.matched {
  background: #f0fdf4;
  border-color: #86efac;
}

.purchase-receipts-xml-match.pending {
  background: #fff7ed;
  border-color: #fdba74;
}

.purchase-receipts-xml-match span {
  color: #475569;
  display: block;
  font-size: 11px;
  font-weight: 800;
}

.purchase-receipts-xml-match strong {
  color: #0f172a;
  display: block;
  font-size: 13px;
}

.purchase-receipts-xml-product-snapshot {
  display: grid;
  gap: 3px;
}

.purchase-receipts-xml-product-tools {
  display: grid;
  gap: 8px;
}

.purchase-receipts-xml-unit-pair {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 10px;
}

.purchase-receipts-xml-unit-pair > div {
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 8px;
}

.purchase-receipts-xml-unit-pair strong {
  color: #0f172a;
  display: block;
  font-size: 12px;
  margin-top: 3px;
}

.purchase-receipts-product-cell select {
  min-width: 0;
}

.purchase-receipts-number-input {
  height: 34px;
  padding: 6px 8px;
  text-align: right;
}

.purchase-receipts-number-input::-webkit-outer-spin-button,
.purchase-receipts-number-input::-webkit-inner-spin-button {
  margin: 0;
  -webkit-appearance: none;
}

.purchase-receipts-number-input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.purchase-receipts-line-total {
  color: #0f172a;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  text-align: right;
  white-space: nowrap;
}

.purchase-receipts-actions-cell {
  text-align: center;
}

.purchase-receipts-item-lot-detail td {
  background: #f8fafc;
  border-top: 0;
  padding: 6px 10px 10px;
}

.purchase-receipts-lot-row {
  align-items: end;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(150px, 1.2fr) minmax(130px, 0.9fr) minmax(130px, 0.9fr) minmax(145px, 1fr) minmax(170px, 1.2fr);
}

.purchase-receipts-lot-row label {
  color: #475569;
  display: grid;
  font-size: 11px;
  font-weight: 800;
  gap: 4px;
  text-transform: uppercase;
}

.purchase-receipts-lot-row .planner-input {
  font-size: 12.5px;
  min-height: 32px;
}

.purchase-receipts-icon-button {
  align-items: center;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  color: #475569;
  cursor: pointer;
  display: inline-flex;
  height: 28px;
  justify-content: center;
  line-height: 1;
  padding: 0;
  width: 28px;
}

.purchase-receipts-icon-button svg {
  display: block;
  fill: currentColor;
  height: 15px;
  width: 15px;
}

.purchase-receipts-icon-button:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #0f172a;
}

.purchase-receipts-items-empty {
  color: #64748b;
  font-size: 13px;
  font-weight: 700;
  padding: 16px;
  text-align: center;
}

.purchase-receipts-products-footer {
  display: flex;
  justify-content: flex-start;
  margin-top: 10px;
}

.purchase-receipts-sort {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font: inherit;
  padding: 0;
  text-transform: inherit;
}

.purchase-receipts-sort span {
  font-size: 10px;
  opacity: 0.85;
}

.purchase-receipts-status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
}

.purchase-receipts-status.draft {
  background: #e0f2fe;
  color: #075985;
}

.purchase-receipts-status.in_review {
  background: #fef3c7;
  color: #92400e;
}

.purchase-receipts-status.received {
  background: #dcfce7;
  color: #166534;
}

.purchase-receipts-status.cancelled {
  background: #fee2e2;
  color: #991b1b;
}

.purchase-receipts-empty {
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  color: #64748b;
  padding: 18px;
}

@media (max-width: 920px) {
  .purchase-receipts-header,
  .purchase-receipts-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .purchase-receipts-header-right {
    align-items: stretch;
    min-width: 0;
    width: 100%;
  }

  .purchase-receipts-top-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-items: stretch;
  }

  .purchase-receipts-filters,
  .purchase-receipts-general,
  .purchase-receipts-commercial,
  .purchase-receipts-source-document,
  .purchase-receipts-notes-row {
    grid-template-columns: 1fr;
  }

  .purchase-receipts-source-summary dl {
    grid-template-columns: 1fr;
  }

  .purchase-receipts-xml-flow,
  .purchase-receipts-xml-fiscal-grid,
  .purchase-receipts-xml-quantity-grid,
  .purchase-receipts-xml-unit-pair,
  .purchase-receipts-lot-row,
  .purchase-receipts-item-capture-grid {
    grid-template-columns: 1fr;
  }

  .purchase-receipts-xml-flow section {
    border-right: 0;
    border-bottom: 1px solid #e2e8f0;
  }

  .purchase-receipts-xml-flow section:last-child {
    border-bottom: 0;
  }

  .purchase-receipts-total-summary {
    grid-template-columns: 1fr;
    min-width: 0;
  }

  .purchase-receipts-notes-field {
    grid-column: span 1;
  }

}
