.receive-body {
  background: #eef2f6;
}

.receive-topbar {
  background: #1e88e5;
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.receive-btn-back {
  background: #fff;
  color: #1e88e5;
  text-decoration: none;
  font-size: 15px;
  font-weight: 700;
  padding: 6px 16px;
  border-radius: 6px;
}

.receive-btn-back:hover {
  background: #e3f2fd;
}

.receive-page {
  width: 95%;
  max-width: 1200px;
  margin: 20px auto 24px;
  background: #fff;
  border-radius: 10px;
  padding: 20px;
  box-shadow: 0 1px 8px rgba(0,0,0,.08);
  box-sizing: border-box;
}

.receive-back {
  color: #1e88e5;
  text-decoration: none;
  font-weight: 600;
}

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

.receive-summary {
  background: #fff;
  border: 1px solid #e4e7eb;
  border-radius: 8px;
  padding: 16px 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}

.receive-summary-label {
  color: #666;
  font-size: 14px;
}

.receive-summary-value {
  font-size: 42px;
  font-weight: 700;
  color: #222;
  line-height: 1.1;
}

.receive-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid #ddd;
  margin-bottom: 18px;
}

.receive-tab {
  background: none;
  border: none;
  padding: 10px 14px 12px;
  font-family: 'Bai Jamjuree', sans-serif;
  font-size: 15px;
  color: #555;
  cursor: pointer;
  position: relative;
}

.receive-tab.active {
  color: #1e88e5;
  font-weight: 700;
}

.receive-tab.active::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: -1px;
  height: 3px;
  background: #1e88e5;
  border-radius: 2px 2px 0 0;
}

.receive-badge {
  display: inline-block;
  min-width: 18px;
  padding: 1px 6px;
  margin-left: 4px;
  background: #e53935;
  color: #fff;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
}

.receive-section-title {
  margin: 0 0 12px;
  font-size: 20px;
}

.receive-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px 12px;
  margin-bottom: 12px;
}

.receive-controls label {
  display: flex;
  flex-direction: column;
  font-size: 13px;
  font-weight: 600;
  gap: 4px;
}

.receive-controls input[type="date"],
.receive-controls input[type="text"] {
  min-width: 140px;
  padding: 7px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-family: 'Bai Jamjuree', sans-serif;
}

.receive-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.rcv-refresh-note {
  font-size: 11px;
  color: #888;
}

.rcv-btn {
  border: none;
  color: #fff;
  padding: 9px 14px;
  border-radius: 6px;
  font-family: 'Bai Jamjuree', sans-serif;
  font-weight: 600;
  cursor: pointer;
  font-size: 13px;
}

.rcv-green { background: #43a047; }
.rcv-orange { background: #fb8c00; }
.rcv-purple { background: #8e24aa; }
.rcv-red { background: #e53935; }
.rcv-gold { background: #f9a825; color: #222; }

.receive-search input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #ccc;
  border-radius: 6px;
  margin-bottom: 12px;
  box-sizing: border-box;
  font-family: 'Bai Jamjuree', sans-serif;
}

.receive-table-wrap {
  overflow-x: auto;
}

.receive-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  table-layout: fixed;
  min-width: 0;
}

.receive-table th {
  background: #2e7d32;
  color: #fff;
  padding: 6px 2px;
  text-align: center;
  font-weight: 600;
  font-size: 11px;
  line-height: 1.2;
}

.receive-table th.col-narrow,
#stockTable td:nth-child(-n+4),
#stockTable td:nth-child(6),
#stockTable td:nth-child(7),
#stockTable td:nth-child(8),
#stockTable td:nth-child(9) {
  width: 6.2%;
  white-space: normal;
  line-height: 1.2;
  word-break: break-word;
}

.receive-table th.col-product,
#stockTable td:nth-child(5) {
  width: 9%;
  min-width: 0;
  max-width: 120px;
  white-space: normal;
  text-align: left;
  word-break: break-word;
  line-height: 1.25;
}

.receive-table th.col-lot,
.receive-table td.lot-cell {
  width: 4.8%;
  min-width: 0;
}

.receive-table td {
  border: 1px solid #ddd;
  padding: 4px 2px;
  text-align: right;
}

.receive-table td.product-name {
  text-align: left;
  font-weight: 500;
  font-size: 12px;
}

.receive-table td.remain {
  font-weight: 700;
  padding: 0;
}

.remain-btn {
  display: block;
  width: 100%;
  min-height: 34px;
  margin: 0;
  padding: 4px 6px;
  border: 0;
  background: none;
  font-family: inherit;
  font-size: inherit;
  font-weight: 700;
  color: #2e7d32;
  text-decoration: underline;
  cursor: pointer;
}

.remain-btn:hover {
  color: #1b5e20;
  background: #e8f5e9;
}

.receive-table td.diff-qty.is-neg {
  color: #c62828;
  font-weight: 700;
}

#stockTable th.col-fg-request {
  background: #81c784;
  color: #1b5e20;
}

.receive-table td.request-qty {
  background: #e8f5e9;
  color: #1b5e20;
  font-weight: 700;
}

.receive-table td.lot-cell {
  background: #fff;
  text-align: center;
  padding: 0;
}

.receive-table td.lot-cell.has-value {
  background: #c8e6c9;
}

.receive-table td.lot-cell.has-value.fg-pending {
  background: #fff8e1;
}

.receive-table td.lot-cell.has-value.fg-approved {
  background: #a5d6a7;
}

.fg-status-ok {
  color: #2e7d32;
  font-weight: 700;
}

.fg-status-wait {
  color: #ef6c00;
  font-weight: 600;
}

.receive-table td.lot-cell.has-value .slot-input {
  color: #1b5e20;
  font-weight: 700;
}

.slot-input {
  width: 100%;
  min-height: 34px;
  box-sizing: border-box;
  border: 0;
  outline: none;
  border-radius: 0;
  box-shadow: none;
  text-align: center;
  padding: 6px 4px;
  font-family: inherit;
  font-size: 13px;
  background: transparent;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: textfield;
}

.receive-table td.lot-cell.slot-locked {
  background: #e3f2fd;
  cursor: pointer;
}

.receive-table td.lot-cell.slot-editable {
  background: #fff8e1;
  cursor: pointer;
}

.receive-table td.lot-cell.slot-locked .slot-input {
  pointer-events: none;
  color: #0d47a1;
  font-weight: 700;
  background: transparent;
  cursor: pointer;
}

.receive-table td.lot-cell.slot-editable .slot-input {
  pointer-events: none;
  color: #f57c00;
  background: transparent;
  cursor: pointer;
}

.receive-table td.lot-cell.slot-locked:hover,
.receive-table td.lot-cell.slot-editable:hover {
  filter: brightness(0.97);
}

/* Detail modal (view-only) */
.detail-modal {
  background: #f8f9fa;
  border-radius: 18px;
  padding: 24px;
  width: 92%;
  max-width: 420px;
  box-shadow: 0 8px 32px rgba(0,0,0,.22);
}

.detail-modal-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.detail-truck {
  font-size: 22px;
}

.detail-modal-head h2 {
  margin: 0;
  font-size: 19px;
  color: #2e7d32;
  font-weight: 700;
}

.detail-subtitle {
  color: #666;
  font-size: 15px;
  margin-bottom: 14px;
}

.detail-qty {
  color: #2e7d32;
  font-weight: 700;
  font-size: 20px;
  margin-bottom: 22px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 18px;
}

.detail-field {
  background: #fff;
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: 0 2px 6px rgba(0,0,0,.06);
}

.detail-label {
  color: #888;
  font-size: 13px;
  margin-bottom: 6px;
}

.detail-value {
  color: #222;
  font-weight: 700;
  font-size: 16px;
  line-height: 1.4;
}

.detail-note {
  background: #fff;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 20px;
  box-shadow: 0 2px 6px rgba(0,0,0,.06);
}

.detail-note-label {
  color: #c62828;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}

.detail-note-value {
  color: #222;
  font-size: 15px;
  font-weight: 700;
}

.detail-actions {
  display: flex;
  justify-content: center;
}

.detail-btn-close {
  background: #e0e0e0;
  color: #333;
  border: 0;
  border-radius: 10px;
  padding: 10px 32px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  min-width: 120px;
}

.detail-btn-close:hover {
  background: #d5d5d5;
}

.slot-input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.slot-input:focus {
  outline: none;
  background: #e8f5e9;
}

.slot-input::placeholder {
  color: #bdbdbd;
  font-weight: 400;
  opacity: 1;
}

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

.receive-table tbody tr:nth-child(even) { background: #fafafa; }

.locked-detail-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0 4px;
  font-size: 14px;
}

.locked-detail-table th,
.locked-detail-table td {
  padding: 10px 8px;
  text-align: left;
  border-bottom: 1px solid #e0e0e0;
}

.locked-detail-table th {
  width: 38%;
  color: #666;
  font-weight: 600;
  background: #f5f5f5;
}

.locked-detail-table td {
  color: #222;
  font-weight: 500;
}

.locked-detail-table tr:last-child th,
.locked-detail-table tr:last-child td {
  border-bottom: 0;
}

.move-type {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.move-type-in {
  background: #e8f5e9;
  color: #1b5e20;
}

.move-type-out {
  background: #ffebee;
  color: #b71c1c;
}

.move-qty-in {
  color: #1b5e20;
  font-weight: 700;
}

.move-qty-out {
  color: #c62828;
  font-weight: 700;
}

.receive-history-table {
  table-layout: auto;
  min-width: 720px;
}

.receive-history-table th,
.receive-history-table td {
  white-space: nowrap;
}

.receive-history-table td.product-name {
  white-space: normal;
  min-width: 120px;
}

.history-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: flex-end;
  margin: 0 0 14px;
  padding: 12px 14px;
  background: #f7faf8;
  border: 1px solid #e2e8e4;
  border-radius: 8px;
}

.history-filters label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
  color: #444;
}

.history-filters select,
.history-filters input[type="text"],
.history-filters input[type="date"] {
  min-width: 140px;
  padding: 7px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-family: "Bai Jamjuree", sans-serif;
  font-size: 13px;
  font-weight: 400;
  background: #fff;
}

.history-search-label {
  flex: 1 1 220px;
}

.history-search-label input {
  width: 100%;
  min-width: 180px;
  box-sizing: border-box;
}

.history-filter-meta {
  margin-left: auto;
  font-size: 12px;
  font-weight: 600;
  color: #666;
  padding-bottom: 8px;
}

.ship-modal {
  background: #fff;
  border-radius: 14px;
  padding: 22px 24px 20px;
  width: 92%;
  max-width: 420px;
  box-shadow: 0 8px 32px rgba(0,0,0,.22);
}

.ship-modal-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.ship-truck {
  font-size: 22px;
}

.ship-modal-head h2 {
  margin: 0;
  font-size: 18px;
  color: #2e7d32;
  font-weight: 700;
}

.ship-product {
  color: #555;
  font-size: 15px;
  margin-bottom: 10px;
}

.ship-qty {
  display: inline-block;
  background: #e8f5e9;
  color: #2e7d32;
  font-weight: 700;
  font-size: 16px;
  padding: 6px 14px;
  border-radius: 8px;
  margin-bottom: 8px;
}

.ship-lot-remain {
  color: #c62828;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 16px;
  min-height: 18px;
}

.ship-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
  flex: 1;
}

.ship-field label {
  font-size: 13px;
  font-weight: 600;
  color: #333;
}

.ship-field select,
.ship-field input {
  padding: 8px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-family: inherit;
  font-size: 14px;
  background: #fff;
}

.ship-row {
  display: flex;
  gap: 12px;
}

.ship-problem {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 600;
  margin: 4px 0 16px;
  cursor: pointer;
}

.ship-problem input {
  width: 16px;
  height: 16px;
}

.ship-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.ship-btn-cancel,
.ship-btn-confirm {
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

.ship-btn-cancel {
  background: #e0e0e0;
  color: #333;
}

.ship-btn-cancel:hover { background: #d5d5d5; }

.ship-btn-confirm {
  background: #43a047;
  color: #fff;
}

.ship-btn-confirm:hover { background: #388e3c; }

.ship-btn-confirm:disabled,
.ship-btn-cancel:disabled {
  opacity: 0.6;
  cursor: default;
}

.lot-remain-modal {
  max-width: 460px;
}

.lot-remain-hint {
  color: #666;
  font-size: 13px;
  margin: 0 0 12px;
}

.lot-remain-table-wrap {
  max-height: 280px;
  overflow: auto;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
}

.lot-remain-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.lot-remain-table th {
  background: #2e7d32;
  color: #fff;
  font-weight: 600;
  padding: 8px 10px;
  text-align: center;
}

.lot-remain-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #eee;
  text-align: center;
}

.lot-remain-table td.lot-remain-lot {
  font-weight: 700;
}

.lot-remain-table td.lot-remain-qty {
  font-weight: 700;
  color: #2e7d32;
  text-align: right;
}

.lot-remain-empty {
  display: none;
  margin: 12px 0 4px;
  color: #888;
  font-size: 13px;
}

.lot-remain-total {
  margin: 10px 0 16px;
  font-weight: 700;
  color: #333;
}

.lot-remain-modal .ship-actions {
  justify-content: flex-end;
}
