/* ── Receive Stock Modal ─────────────────────────────────────────────────────
   Industrial / utilitarian aesthetic — matches store_dashboard.css
   ─────────────────────────────────────────────────────────────────────────── */

/* Overlay */
.rs-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(3px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

/* Ensure the HTML hidden attribute always wins over display:flex */
.rs-overlay[hidden] {
  display: none !important;
}

/* Modal shell */
.rs-modal {
  background: var(--bg, #fff);
  border-radius: 12px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.25);
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.rs-modal--confirm {
  max-width: 620px;
}

/* Header */
.rs-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 2px solid var(--color-border, #e2e0d8);
  background: rgba(17, 25, 40, 0.06);
  flex-shrink: 0;
}

.rs-modal-header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--major-link, #0096FF);
  font-family: 'Quantico-Regular', sans-serif;
}

.rs-close-btn {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: var(--color-text-muted, #7a7870);
  padding: 0.25rem;
  line-height: 1;
  transition: color 0.15s;
}
.rs-close-btn:hover { color: var(--color-danger, #b91c1c); background: none; }

/* Body */
.rs-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Meta strip */
.rs-meta-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--color-border, #e2e0d8);
}

/* Field */
.rs-field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.rs-field label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted, #7a7870);
}
.rs-field input,
.rs-field textarea,
.rs-field select {
  padding: 0.5rem 0.7rem;
  border: 1.5px solid var(--color-border, #e2e0d8);
  border-radius: 6px;
  font-size: 0.875rem;
  background: var(--bg, #fff);
  color: var(--text, #1a1a1a);
  transition: border-color 0.15s;
  font-family: inherit;
  margin: 0;
}
.rs-field input:focus,
.rs-field textarea:focus {
  outline: none;
  border-color: var(--major-link, #0096FF);
  box-shadow: 0 0 0 2px rgba(0, 150, 255, 0.15);
}

/* Two column layout */
.rs-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  flex: 1;
  min-height: 0;
}

.rs-col {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.rs-col h4 {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted, #7a7870);
  margin: 0;
}

/* Search */
.rs-search {
  padding: 0.5rem 0.75rem;
  border: 1.5px solid var(--color-border, #e2e0d8);
  border-radius: 6px;
  font-size: 0.875rem;
  background: var(--bg, #fff);
  color: var(--text, #1a1a1a);
  margin: 0;
}
.rs-search:focus {
  outline: none;
  border-color: var(--major-link, #0096FF);
}

/* Product list */
.rs-product-list {
  flex: 1;
  overflow-y: auto;
  border: 1px solid var(--color-border, #e2e0d8);
  border-radius: 8px;
  background: var(--bg);
  max-height: 320px;
}

.rs-product-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.875rem;
  border-bottom: 1px solid var(--color-border, #e2e0d8);
  transition: background 0.12s;
}
.rs-product-row:last-child { border-bottom: none; }
.rs-product-row:hover { background: rgba(0, 150, 255, 0.04); }
.rs-product-row.rs-selected { background: rgba(0, 179, 104, 0.06); }

.rs-product-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.rs-product-name {
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--text, #1a1a1a);
}
.rs-product-brand,
.rs-product-stock {
  font-size: 0.7rem;
  color: var(--color-text-muted, #7a7870);
}

.rs-add-btn {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.3rem 0.7rem;
  border-radius: 5px;
  border: 1.5px solid var(--major-link, #0096FF);
  background: transparent;
  color: var(--major-link, #0096FF);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.rs-add-btn:hover { background: var(--major-link, #0096FF); color: #fff; }
.rs-add-btn.rs-added {
  border-color: var(--color-success, #15803d);
  color: var(--color-success, #15803d);
  cursor: default;
}

/* Selected items */
.rs-selected-items {
  flex: 1;
  overflow-y: auto;
  border: 1px solid var(--color-border, #e2e0d8);
  border-radius: 8px;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-height: 260px;
  background: var(--bg);
}

.rs-item-row {
  background: rgba(17, 25, 40, 0.04);
  border: 1px solid var(--color-border, #e2e0d8);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.rs-item-name {
  font-size: 0.83rem;
  font-weight: 600;
}
.rs-item-brand {
  font-size: 0.7rem;
  color: var(--color-text-muted, #7a7870);
  margin-left: 0.4rem;
  font-weight: 400;
}
.rs-item-controls {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}
.rs-item-controls label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted, #7a7870);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.rs-input {
  padding: 0.35rem 0.5rem;
  border: 1.5px solid var(--color-border, #e2e0d8);
  border-radius: 5px;
  font-size: 0.8rem;
  width: 90px;
  background: var(--bg);
  color: var(--text);
  margin: 0;
}
.rs-unit {
  font-size: 0.65rem;
  color: var(--color-text-muted);
  margin-top: 0.1rem;
}
.rs-subtotal {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--major-link, #0096FF);
  font-family: 'Quantico-Regular', monospace;
  margin-left: auto;
}
.rs-remove-btn {
  background: none;
  border: none;
  color: var(--color-danger, #b91c1c);
  font-size: 0.9rem;
  cursor: pointer;
  padding: 0.2rem;
  line-height: 1;
}
.rs-remove-btn:hover { background: var(--color-danger-lt, #fee2e2); border-radius: 4px; }

/* Total bar */
.rs-total-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0.75rem;
  background: rgba(0, 150, 255, 0.06);
  border: 1px solid rgba(0, 150, 255, 0.2);
  border-radius: 8px;
  font-size: 0.85rem;
}
.rs-total-bar strong {
  font-size: 1.05rem;
  font-family: 'Quantico-Regular', monospace;
  color: var(--major-link, #0096FF);
}

/* Actions */
.rs-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 0.25rem;
}
.rs-actions--confirm {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--color-border, #e2e0d8);
  background: rgba(17, 25, 40, 0.04);
}

.rs-btn {
  padding: 0.6rem 1.25rem;
  border-radius: 7px;
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  font-family: 'Quantico-Regular', sans-serif;
}
.rs-btn-primary {
  background: var(--major-link, #0096FF);
  color: #fff;
}
.rs-btn-primary:hover { opacity: 0.88; }
.rs-btn-primary:disabled {
  background: var(--color-border, #e2e0d8);
  color: var(--color-text-muted, #7a7870);
  cursor: not-allowed;
}
.rs-btn-secondary {
  background: transparent;
  border: 1.5px solid var(--color-border, #e2e0d8);
  color: var(--text, #1a1a1a);
}
.rs-btn-secondary:hover { border-color: var(--text); background: transparent; }
.rs-btn-confirm {
  background: var(--color-success, #15803d);
  color: #fff;
  font-size: 0.9rem;
}
.rs-btn-confirm:hover { opacity: 0.88; }

/* Empty state */
.rs-empty {
  padding: 1rem;
  text-align: center;
  color: var(--color-text-muted, #7a7870);
  font-size: 0.83rem;
}

/* Confirm modal content */
.rs-confirm-meta {
  display: flex;
  gap: 1.5rem;
  flex-wrap: wrap;
  font-size: 0.875rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--color-border, #e2e0d8);
  margin-bottom: 0.75rem;
}
.rs-confirm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
  margin-bottom: 1rem;
}
.rs-confirm-table th {
  padding: 0.5rem 0.75rem;
  text-align: left;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  background: rgba(17, 25, 40, 0.04);
  border-bottom: 2px solid var(--color-border);
}
.rs-confirm-table td {
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--color-border);
}
.rs-confirm-warning {
  font-size: 0.78rem;
  color: var(--color-warning, #d97706);
  background: var(--color-warning-lt, #fef3c7);
  padding: 0.6rem 0.875rem;
  border-radius: 6px;
  border: 1px solid var(--color-warning, #d97706);
}

/* Section header row */
.section-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

/* Receipt details list */
.rs-detail-list {
  margin: 0.5rem 0 0.25rem 1rem;
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

/* Mobile */
@media (max-width: 700px) {
  .rs-two-col {
    grid-template-columns: 1fr;
  }
  .rs-modal {
    max-height: 95vh;
  }
  .rs-meta-strip {
    grid-template-columns: 1fr;
  }
}

/* ── Three-column browse layout ──────────────────────────────────────────── */

.rs-browse {
  display: grid;
  grid-template-columns: 200px 1fr 1fr;
  gap: 0;
  flex: 1;
  min-height: 0;
  border: 1px solid var(--color-border, #e2e0d8);
  border-radius: 10px;
  overflow: hidden;
}

.rs-browse-col {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--color-border, #e2e0d8);
}
.rs-browse-col:last-child { border-right: none; }

.rs-col-header {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--color-text-muted, #7a7870);
  padding: 0.6rem 0.875rem;
  background: rgba(17, 25, 40, 0.04);
  border-bottom: 1px solid var(--color-border, #e2e0d8);
  flex-shrink: 0;
}

/* Category column */
.rs-category-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.4rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.rs-cat-group {
  display: flex;
  flex-direction: column;
}

.rs-cat-btn,
.rs-sub-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  text-align: left;
  padding: 0.45rem 0.6rem;
  border-radius: 6px;
  border: none;
  background: transparent;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text, #1a1a1a);
  cursor: pointer;
  transition: background 0.12s;
  margin: 0;
}
.rs-cat-btn:hover,
.rs-sub-btn:hover {
  background: rgba(0, 150, 255, 0.08);
}
.rs-cat-btn.rs-active,
.rs-sub-btn.rs-active {
  background: rgba(0, 150, 255, 0.12);
  color: var(--major-link, #0096FF);
  font-weight: 700;
}
.rs-cat-all {
  font-weight: 600;
  border-bottom: 1px solid var(--color-border, #e2e0d8);
  border-radius: 0;
  margin-bottom: 0.35rem;
  padding-bottom: 0.55rem;
}

.rs-sub-group {
  padding-left: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.rs-sub-btn {
  font-size: 0.73rem;
  padding: 0.35rem 0.5rem;
  color: var(--color-text-muted, #7a7870);
}
.rs-sub-btn.rs-active { color: var(--major-link, #0096FF); }

.rs-count {
  font-size: 0.65rem;
  background: var(--color-border, #e2e0d8);
  color: var(--color-text-muted, #7a7870);
  padding: 0.1em 0.45em;
  border-radius: 999px;
  font-weight: 700;
  flex-shrink: 0;
  margin-left: 0.35rem;
}

/* Product list column */
.rs-product-list {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

.rs-product-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 0.65rem 0.875rem;
  border-bottom: 1px solid var(--color-border, #e2e0d8);
  gap: 0.75rem;
  transition: background 0.1s;
}
.rs-product-row:last-child { border-bottom: none; }
.rs-product-row:hover { background: rgba(0, 150, 255, 0.04); }
.rs-product-row.rs-selected { background: rgba(0, 179, 104, 0.05); }

.rs-product-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1;
  min-width: 0;
}
.rs-product-name {
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--text, #1a1a1a);
}
.rs-product-meta {
  font-size: 0.7rem;
  color: var(--color-text-muted, #7a7870);
}
.rs-product-foot {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.rs-product-stock {
  font-size: 0.7rem;
  color: var(--color-text-muted, #7a7870);
}
.rs-in-store-badge {
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0.1em 0.4em;
  border-radius: 999px;
  background: rgba(0, 150, 255, 0.1);
  color: var(--major-link, #0096FF);
  border: 1px solid rgba(0, 150, 255, 0.25);
}
.rs-kebs-badge {
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0.1em 0.4em;
  border-radius: 999px;
  background: rgba(0, 179, 104, 0.1);
  color: var(--color-success, #15803d);
  border: 1px solid rgba(0, 179, 104, 0.25);
}

.rs-add-btn {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.3rem 0.65rem;
  border-radius: 5px;
  border: 1.5px solid var(--major-link, #0096FF);
  background: transparent;
  color: var(--major-link, #0096FF);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
  margin: 0;
}
.rs-add-btn:hover:not(:disabled) {
  background: var(--major-link, #0096FF);
  color: #fff;
}
.rs-add-btn.rs-added {
  border-color: var(--color-success, #15803d);
  color: var(--color-success, #15803d);
  cursor: default;
}

/* Items column (right panel) */
.rs-browse-col--items {
  background: rgba(17, 25, 40, 0.02);
  padding: 0;
}

.rs-selected-items {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.rs-item-row {
  background: var(--bg, #fff);
  border: 1px solid var(--color-border, #e2e0d8);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.rs-item-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}
.rs-item-name {
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.3;
}
.rs-item-brand {
  font-size: 0.68rem;
  color: var(--color-text-muted, #7a7870);
  font-weight: 400;
  margin-left: 0.3rem;
}
.rs-item-controls {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
  flex-wrap: wrap;
}
.rs-item-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted, #7a7870);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.rs-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.rs-input {
  padding: 0.3rem 0.45rem;
  border: 1.5px solid var(--color-border, #e2e0d8);
  border-radius: 5px;
  font-size: 0.78rem;
  width: 72px;
  background: var(--bg);
  color: var(--text);
  margin: 0;
}
.rs-input--cost { width: 84px; }
.rs-input:focus {
  outline: none;
  border-color: var(--major-link, #0096FF);
}
.rs-unit {
  font-size: 0.65rem;
  color: var(--color-text-muted);
}
.rs-item-subtotal {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  margin-left: auto;
}
.rs-subtotal-label {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  font-weight: 700;
}
.rs-subtotal-value {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--major-link, #0096FF);
  font-family: 'Quantico-Regular', monospace;
}
.rs-remove-btn {
  background: none;
  border: none;
  color: var(--color-text-muted, #7a7870);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0.1rem 0.2rem;
  line-height: 1;
  flex-shrink: 0;
  margin: 0;
  transition: color 0.12s;
}
.rs-remove-btn:hover {
  color: var(--color-danger, #b91c1c);
  background: none;
}

.rs-total-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.55rem 0.875rem;
  background: rgba(0, 150, 255, 0.06);
  border-top: 1px solid rgba(0, 150, 255, 0.15);
  border-bottom: 1px solid rgba(0, 150, 255, 0.15);
  font-size: 0.83rem;
  font-weight: 600;
  flex-shrink: 0;
}
.rs-total-bar strong {
  font-family: 'Quantico-Regular', monospace;
  font-size: 1rem;
  color: var(--major-link, #0096FF);
}

.rs-field--notes {
  padding: 0.5rem 0.75rem 0;
  flex-shrink: 0;
}
.rs-field--notes label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted, #7a7870);
  display: block;
  margin-bottom: 0.3rem;
}
.rs-field--notes textarea {
  width: 100%;
  padding: 0.4rem 0.6rem;
  border: 1.5px solid var(--color-border, #e2e0d8);
  border-radius: 6px;
  font-size: 0.8rem;
  background: var(--bg);
  color: var(--text);
  resize: none;
  font-family: inherit;
  margin: 0;
}
.rs-field--notes textarea:focus {
  outline: none;
  border-color: var(--major-link, #0096FF);
}

.rs-hint { color: var(--color-text-muted, #7a7870); font-style: italic; }
.rs-error { color: var(--color-danger, #b91c1c); }

/* Mobile: stack columns */
@media (max-width: 768px) {
  .rs-browse {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
  }
  .rs-browse-col { border-right: none; border-bottom: 1px solid var(--color-border); }
  .rs-browse-col:last-child { border-bottom: none; }
  .rs-category-list,
  .rs-product-list,
  .rs-selected-items { max-height: 200px; }
}
