#grn-form-page .muted{ color:#6b7280; }
#grn-form-page .mini{ font-size:.82rem; }

#grn-form-page {
  width: 100%;
  max-width: none;
  margin-inline: 0;
  padding-inline: clamp(10px, 1.4vw, 22px);
}

.doc-head{
  display:flex; justify-content:space-between; align-items:center;
  gap:12px; margin-bottom:14px; flex-wrap:wrap;
}
.doc-head .title{ display:flex; align-items:center; gap:10px; }
.badge-doc{
  width:46px; height:46px; border-radius:14px;
  display:flex; align-items:center; justify-content:center;
  background: rgba(99,102,241,.14);
  color:#3730a3; font-weight:800;
}
.pill{
  display:inline-flex; align-items:center; padding:.25rem .6rem;
  border-radius:999px; font-size:.78rem; font-weight:800;
  border:1px solid transparent;
}
.pill-new{ background:rgba(59,130,246,.12); color:#1d4ed8; border-color:rgba(59,130,246,.2); }
.pill-draft{ background:rgba(59,130,246,.12); color:#1d4ed8; border-color:rgba(59,130,246,.2); }
.pill-posted{ background:rgba(34,197,94,.14); color:#166534; border-color:rgba(34,197,94,.22); }
.pill-cancel{ background:rgba(239,68,68,.14); color:#991b1b; border-color:rgba(239,68,68,.22); }

.grid{
  display:grid;
  grid-template-columns: 1fr;
  gap:12px;
}

.cardx{
  background:#fff; border-radius:16px;
  box-shadow: 0 8px 24px rgba(15,23,42,.06);
  border:1px solid rgba(15,23,42,.06);
  overflow:hidden;
}
.cardx-h{
  padding:12px 14px;
  font-weight:800;
  border-bottom:1px solid rgba(15,23,42,.06);
  background: linear-gradient(180deg, rgba(249,250,251,1), rgba(255,255,255,1));
}
.cardx-b{ padding:14px; }

.main-row {
  background: #f9fafb;
  border: 1px solid #eee;
  border-radius: 8px;
}

.main-row:hover {
  background: #f1f5f9;
}
#linesBody input {
  text-align: center;
  font-size: 13px;
}

#linesBody .required {
  background: #f3f4f6;
}

#linesBody .received {
  background: #dcfce7;
}

#linesBody .remaining {
  background: #fef3c7;
}

#linesBody .receive-now {
  background: #dbeafe;
  font-weight: bold;
}

#linesBody .unit-cost {
  background: #eef2ff;
  font-weight: bold;
}

.delete-line {
  padding: 4px 8px;
}

#linesBody input {
  text-align: center;
  font-size: 13px;
}

.required { background:#f3f4f6; }
.received { background:#dcfce7; }
.remaining { background:#fef3c7; }
.receive-now { background:#dbeafe; font-weight:bold; }

.purchase-price { background:#eef2ff; }
.unit-cost { background:#e0e7ff; font-weight:bold; }
.line-total { background:#ecfeff; font-weight:bold; }
.table-responsive {
  overflow-x: auto;
}

table th:first-child,
table td:first-child {
  position: sticky;
  left: 0;
  background: white;
  z-index: 2;
}

#linesBody td:has(.item-select) {
  min-width: 340px;
}

.erp-item-option-main {
  font-weight: 700;
  color: #111827;
  line-height: 1.25;
}

.erp-item-option-meta {
  margin-top: 2px;
  font-size: 11px;
  color: #64748b;
}

.select2-container--default .select2-results__option--highlighted .erp-item-option-main,
.select2-container--default .select2-results__option--highlighted .erp-item-option-meta {
  color: #fff;
}

.inv-column-menu {
  min-width: 190px;
  max-height: 320px;
  overflow: auto;
}

.inv-column-menu .dropdown-item {
  cursor: pointer;
  border-radius: 6px;
  white-space: nowrap;
}

.doc-line-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  margin-inline-start: auto;
}

.rfid-document-panel {
  margin-top: 14px;
  border: 1px solid #dbe5f3;
  border-radius: 14px;
  background: linear-gradient(180deg, #f8fbff, #fff);
  overflow: hidden;
}

.rfid-document-panel .rfid-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid #e5edf7;
}

.rfid-document-panel .rfid-body {
  padding: 14px;
}

.rfid-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(105px, 1fr));
  gap: 8px;
}

.rfid-kpi {
  border: 1px solid #e5edf7;
  border-radius: 10px;
  background: #fff;
  padding: 8px 10px;
}

.rfid-kpi span {
  display: block;
  color: #64748b;
  font-size: 11px;
}

.rfid-kpi strong {
  display: block;
  color: #0f172a;
  font-size: 18px;
  line-height: 1.2;
}

.rfid-result-table th,
.rfid-result-table td {
  white-space: nowrap;
}

#grn-form-page .doc-head {
  padding: 14px 16px;
  border: 1px solid rgba(15, 23, 42, .07);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .055);
}

#grn-form-page .doc-head .right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

#grn-form-page .doc-head .right .btn {
  min-height: 36px;
}

#grn-form-page .cardx {
  border-radius: 14px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, .055);
}

#grn-form-page .cardx-h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

#grn-form-page .cardx-b {
  padding: clamp(10px, 1.1vw, 16px);
}

#grn-form-page .row.g-3 {
  --bs-gutter-x: .85rem;
  --bs-gutter-y: .75rem;
}

#grn-form-page .form-control,
#grn-form-page .form-select,
#grn-form-page .select2-container .select2-selection--single {
  min-height: 36px;
  border-color: #dbe3ef;
}

#grn-form-page .table-responsive {
  border: 1px solid #e5eaf2;
  border-radius: 12px;
  background: #fff;
  max-width: 100%;
  max-height: 485px;
  overflow: auto;
  scrollbar-gutter: stable;
}

#grnLinesTable {
  min-width: 2380px;
  width: max-content;
  margin-bottom: 0;
}

#grnLinesTable th,
#grnLinesTable td { min-width: 105px; }
#grnLinesTable [data-col="item"] { min-width: 340px; }
#grnLinesTable [data-col="variant"] { min-width: 170px; }
#grnLinesTable [data-col="batch"] { min-width: 145px; }
#grnLinesTable [data-col="expiry"] { min-width: 150px; }
#grnLinesTable [data-col="notes"] { min-width: 190px; }
#grnLinesTable [data-col="actions"] { min-width: 52px; width: 52px; }

#grnLinesTable thead th {
  position: sticky;
  top: 0;
  z-index: 4;
  background: #f8fafc;
  color: #243044;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
  border-bottom: 1px solid #dce4ef;
}

#grnLinesTable td {
  vertical-align: middle;
  white-space: nowrap;
  padding-block: 6px;
}

#grnLinesTable th:first-child,
#grnLinesTable td:first-child {
  position: sticky;
  right: 0;
  left: auto;
  z-index: 3;
  background: #fff;
}

#grnLinesTable thead th:first-child {
  z-index: 6;
  background: #f8fafc;
}

#grnLinesTable .form-control-sm,
#grnLinesTable .form-select-sm {
  min-height: 31px;
  padding-top: 4px;
  padding-bottom: 4px;
}

#grn-form-page .doc-line-actions .btn {
  min-height: 34px;
}

@media (max-width: 992px) {
  #grn-form-page {
    padding-inline: 8px;
  }

  #grn-form-page .doc-head {
    align-items: stretch;
  }

  #grn-form-page .doc-head .title {
    width: 100%;
  }

  #grn-form-page .doc-head .right {
    width: 100%;
    justify-content: flex-start;
  }

  #grn-form-page .doc-head .right .btn {
    flex: 1 1 132px;
  }

  #grn-form-page .cardx-h {
    align-items: stretch;
  }

  #grn-form-page .doc-line-actions {
    width: 100%;
    justify-content: flex-start;
    margin-inline-start: 0;
  }

  #grn-form-page .doc-line-actions .btn,
  #grn-form-page .doc-line-actions .dropdown {
    flex: 1 1 135px;
  }

  #grn-form-page .rfid-document-panel .rfid-head {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 576px) {
  #grn-form-page .badge-doc {
    width: 40px;
    height: 40px;
    border-radius: 12px;
  }

  #grn-form-page .doc-head h4 {
    font-size: 1rem;
  }

  #grn-form-page .cardx {
    border-radius: 12px;
  }
}
