/* ═══════════════════════════════════════════════════════════════════════
   Operations CSS — shared styles for all enterprise stock operation pages
   (editing, negativeEntries, indent, purchaseOrder, salesOrder, etc.)

   Prefix: new-stock-ops-
   Loaded globally via index.html — prefix prevents bleed into other modules.
   ═══════════════════════════════════════════════════════════════════════ */

/* ── Operation Table — dark-header, auto-layout, headers wrap ── */

/* Wrapper spacing — match the margin of design-system cards */
.new-stock-ops-table-wrap,
.table-responsive:has(.new-stock-ops-table) {
  margin-bottom: 20px;
}

.new-stock-ops-table {
  width: 100%;
  border-top: none !important;
  margin-bottom: 0;
}

.new-stock-ops-table,
.new-stock-ops-table > thead > tr > th:first-child,
.new-stock-ops-table > thead > th:first-child,
.new-stock-ops-table > thead > tr > th:last-child,
.new-stock-ops-table > thead > th:last-child,
.new-stock-ops-table > tbody > tr:last-child > td:first-child,
.new-stock-ops-table > tbody > tr:last-child > td:last-child {
  border-radius: 0 !important;
}

/* Header cells — dark bar, text wraps naturally
   Targets th in both thead AND tbody for tables with interleaved headers */
.new-stock-ops-table > thead > tr > th,
.new-stock-ops-table > thead > th,
.new-stock-ops-table > tbody > tr > th,
.new-stock-ops-table > tbody > th {
  background: var(--rw-operation-table-header, #1e1e1e) !important;
  color: #fff !important;
  border-color: rgba(255,255,255,0.15) !important;
  border-width: 0 1px !important;
  border-radius: 0 !important;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase !important;
  letter-spacing: 0.4px;
  padding: 10px 8px;
  font-family: 'Inter', sans-serif;
}

.new-stock-ops-table > thead > tr > th a,
.new-stock-ops-table > tbody > tr > th a {
  color: #fff !important;
  text-decoration: none;
}

.new-stock-ops-table > thead > tr > th {
  border-top: none !important;
  border-bottom: 1px solid rgba(255,255,255,0.15) !important;
}

.new-stock-ops-table > thead > tr:first-child > th:first-child {
  border-left: none !important;
}

.new-stock-ops-table > thead > tr:first-child > th:last-child {
  border-right: none !important;
}

/* Body cells — compact */
.new-stock-ops-table > tbody > tr > td {
  font-size: 12.5px;
  padding: 9px 8px;
  vertical-align: middle;
  font-family: 'Inter', sans-serif;
}

.new-stock-ops-table > tbody > tr > td a {
  cursor: pointer;
}

/* Hover row */
.new-stock-ops-table > tbody > tr:hover {
  background-color: #f8fafc;
}

/* ── Card title inside table cells — standalone accent bar ── */
/* .new-stock-rw-card-title normally requires a .new-stock-rw-form-card parent.
   Inside <td> cells on operation pages, apply the accent bar standalone. */
td h3.new-stock-rw-card-title {
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--rw-text, #1e293b);
  margin: 0 0 12px 0;
  display: flex;
  align-items: center;
  gap: 5px;
  border-left: 3px solid var(--rw-primary);
  padding-left: 8px;
}

/* ============================================================
   Alert modal for Restrict Partial Bins on Supply
   (palette matches Bin/Packaging wizard: #31708f teal-info)
   ============================================================ */
.rw-sap-alert-modal .modal-dialog { width: 1040px; max-width: 96vw; margin: 24px auto; }
.rw-sap-alert-modal .modal-content {
  border: none;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.18);
}
.rw-sap-alert {
  font-family: 'Inter', 'Segoe UI', sans-serif;
  color: #1f2d3d;
  background: #fff;
}
.rw-sap-alert-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 22px;
  background: linear-gradient(135deg, #d9edf7 0%, #bce0ef 100%);
  color: #31708f;
  border-bottom: 1px solid #bce8f1;
}
.rw-sap-alert-icon {
  width: 42px; height: 42px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(49, 112, 143, 0.14);
  color: #31708f;
  border-radius: 50%;
  font-size: 20px;
  flex: 0 0 auto;
}
.rw-sap-alert-heading { flex: 1 1 auto; min-width: 0; }
.rw-sap-alert-title {
  font-size: 16px; font-weight: 700; letter-spacing: 0.2px; line-height: 1.2; color: #31708f;
}
.rw-sap-alert-subtitle {
  font-size: 12px; margin-top: 2px; font-weight: 500; color: #2a4d7a;
}
.rw-sap-alert-close {
  background: rgba(49, 112, 143, 0.12);
  border: none; color: #31708f;
  width: 30px; height: 30px;
  border-radius: 50%;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s ease;
  flex: 0 0 auto;
}
.rw-sap-alert-close:hover { background: rgba(49, 112, 143, 0.24); }

.rw-sap-alert-body { padding: 16px 22px 8px 22px; background: #f7f9fb; }
.rw-sap-alert-message {
  background: #eef5ff;
  border-left: 3px solid #31708f;
  color: #2a4d7a;
  padding: 10px 12px;
  border-radius: 4px;
  font-size: 13px;
  line-height: 1.45;
  margin-bottom: 14px;
}

.rw-sap-alert-grid {
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  gap: 16px;
  align-items: start;
}
.rw-sap-alert-col { min-width: 0; }

.rw-sap-alert-meta {
  display: flex; flex-wrap: wrap; gap: 8px 28px;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid #d6e4f5;
  border-radius: 6px;
  margin-bottom: 12px;
}
.rw-sap-alert-meta-row { display: flex; flex-direction: column; min-width: 110px; }
.rw-sap-alert-meta-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.6px;
  color: #6b7c93; font-weight: 600;
}
.rw-sap-alert-meta-value { font-size: 13px; font-weight: 600; color: #1f2d3d; margin-top: 2px; }

.rw-sap-alert-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.rw-sap-alert-stat {
  border: 1px solid #d6e4f5;
  border-radius: 8px;
  padding: 10px 8px;
  text-align: center;
  background: #fff;
}
.rw-sap-alert-stat-value { font-size: 22px; font-weight: 700; line-height: 1; color: #31708f; }
.rw-sap-alert-stat-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.5px;
  color: #6b7c93; margin-top: 6px; font-weight: 600;
}
.rw-sap-stat-total { background: #eef5ff; border-color: #d6e4f5; }
.rw-sap-stat-total .rw-sap-alert-stat-value { color: #2a4d7a; }
.rw-sap-stat-scanned { background: #e8f4ee; border-color: #cfe7d8; }
.rw-sap-stat-scanned .rw-sap-alert-stat-value { color: #3c763d; }
.rw-sap-stat-remaining { background: #fcf3e3; border-color: #f1dfb8; }
.rw-sap-stat-remaining .rw-sap-alert-stat-value { color: #8a6d3b; }

.rw-sap-alert-progress { margin-bottom: 4px; }
.rw-sap-alert-progress-track {
  height: 8px;
  background: rgba(49, 112, 143, 0.18);
  border-radius: 999px;
  overflow: hidden;
}
.rw-sap-alert-progress-fill {
  height: 100%;
  background: #31708f;
  border-radius: 999px;
  transition: width 0.25s ease;
}
.rw-sap-alert-progress-caption {
  font-size: 11px; color: #6b7c93; font-weight: 600; margin-top: 6px; text-align: right;
}

.rw-sap-alert-section { margin-bottom: 12px; }
.rw-sap-alert-section:last-child { margin-bottom: 0; }
.rw-sap-alert-section-title {
  font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.6px;
  color: #2a4d7a;
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 8px;
}
.rw-sap-alert-section-title.rw-sap-section-pending { color: #8a6d3b; }

.rw-sap-alert-chip-list {
  display: flex; flex-wrap: wrap; gap: 6px;
  max-height: 200px;
  overflow-y: auto;
  padding: 8px;
  background: #fff;
  border: 1px solid #d6e4f5;
  border-radius: 6px;
}
.rw-sap-alert-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px; font-weight: 600;
  border: 1px solid transparent;
  line-height: 1.4;
}
.rw-sap-chip-done { background: #e8f4ee; color: #3c763d; border-color: #cfe7d8; }
.rw-sap-chip-pending { background: #fcf3e3; color: #8a6d3b; border-color: #f1dfb8; }
.rw-sap-alert-empty {
  font-size: 12px; color: #6b7c93; font-style: italic;
  padding: 8px 10px;
  background: #fff;
  border: 1px dashed #d6e4f5;
  border-radius: 6px;
}

.rw-sap-alert-footer {
  padding: 12px 22px 14px 22px;
  display: flex; justify-content: flex-end;
  border-top: 1px solid #eceff3;
  background: #fff;
}
.rw-sap-alert-btn {
  background: #31708f;
  color: #fff;
  border: none;
  padding: 8px 22px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.rw-sap-alert-btn:hover { background: #275d77; color: #fff; }
.rw-sap-alert-btn:focus { outline: 2px solid #bce0ef; outline-offset: 2px; color: #fff; }

@media (max-width: 900px) {
  .rw-sap-alert-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   Inline bin scan counter (shown under Bin Number input)
   ============================================================ */
.rw-bin-scan-counter {
  margin-top: 12px;
  padding: 12px 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-family: 'Inter', 'Segoe UI', sans-serif;
}
.rw-bin-scan-counter-stats {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 10px;
}
.rw-bin-scan-counter-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
  line-height: 1.4;
}
.rw-bin-scan-counter-pill strong { font-weight: 800; font-size: 13px; }
.rw-bin-counter-total { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.rw-bin-counter-scanned { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.rw-bin-counter-remaining { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.rw-bin-counter-remaining.rw-bin-counter-remaining-zero {
  background: #ecfdf5; color: #047857; border-color: #a7f3d0;
}

.rw-bin-scan-counter-progress {
  height: 6px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 8px;
}
.rw-bin-scan-counter-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981 0%, #059669 100%);
  border-radius: 999px;
  transition: width 0.25s ease;
}
.rw-bin-scan-counter-hint {
  font-size: 11.5px;
  color: #78350f;
  background: #fffbeb;
  border: 1px solid #fde68a;
  padding: 6px 10px;
  border-radius: 4px;
}
.rw-bin-scan-counter-hint .fa { margin-right: 4px; color: #b45309; }
.rw-bin-scan-counter-hint.rw-bin-scan-counter-hint-success {
  background: #ecfdf5; border-color: #a7f3d0; color: #047857;
}
.rw-bin-scan-counter-hint.rw-bin-scan-counter-hint-success .fa { color: #047857; }
