.reject-history-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.mode-tab-row {
  display: flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  width: fit-content;
}

.mode-tab {
  padding: 7px 16px;
  border: none;
  background: #f8fafc;
  font-size: 13px;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.mode-tab:not(:last-child) {
  border-right: 1px solid var(--border);
}

.mode-tab.active {
  background: #2563eb;
  color: #fff;
}

.mode-tab:hover:not(.active) {
  background: #eef2f7;
}

.filter-textarea {
  resize: vertical;
  font-family: monospace;
  line-height: 1.5;
}

.supplementary-panel {
  border-top: 1px solid var(--border);
  padding: 16px 18px;
}

.supplementary-header {
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
  margin-bottom: 12px;
}

.supplementary-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  align-items: end;
}

.resolution-info {
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: #0f766e;
  font-weight: 600;
}

.resolution-warn {
  color: #b45309;
  font-weight: 400;
}

.card {
  background: var(--card-bg);
  border-radius: 10px;
  box-shadow: var(--shadow);
  overflow: visible;
  margin-bottom: 14px;
}

.card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: #f8fafc;
  border-radius: 10px 10px 0 0;
}

.card-title {
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
}

.card-body {
  padding: 14px 16px;
}

.error-banner {
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: 6px;
  background: #fef2f2;
  color: #991b1b;
  font-size: 13px;
}

.filter-panel {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  align-items: end;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.filter-group-wide {
  grid-column: span 2;
}

.filter-group-full {
  grid-column: 1 / -1;
}

.filter-label {
  font-size: 12px;
  font-weight: 700;
  color: #475569;
}

.filter-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  background: #fff;
}

.filter-input:focus {
  outline: none;
  border-color: #0ea5e9;
  box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.18);
}

.filter-group .multi-select {
  width: 100%;
  min-width: 0;
}

.filter-toolbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.checkbox-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.checkbox-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 13px;
  color: #334155;
  background: #f8fafc;
}

.checkbox-pill input[type='checkbox'] {
  margin: 0;
  width: 14px;
  height: 14px;
  accent-color: #2563eb;
}

.filter-actions {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

.active-filter-chip-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid var(--border);
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  font-size: 12px;
  color: #334155;
}

.chip-remove {
  border: 0;
  background: transparent;
  color: #475569;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}

.btn.btn-primary:hover {
  background: var(--primary-dark);
  color: #fff;
}

.btn.btn-secondary:hover {
  background: #5a6268;
  color: #fff;
}

.btn.btn-export {
  background: #0f766e;
  color: #fff;
}

.btn.btn-export:hover {
  background: #0b5e59;
  color: #fff;
}

.btn.btn-export:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.btn-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-right: 6px;
  vertical-align: middle;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.reject-summary-row {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.lane-reject {
  border-top: 3px solid #dc2626;
}

.lane-defect {
  border-top: 3px solid #0284c7;
}

.lane-neutral {
  border-top: 3px solid #64748b;
}

.chart-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  margin-bottom: 14px;
}

.chart-wrap,
.pareto-chart-wrap {
  width: 100%;
  height: 340px;
  position: relative;
  overflow: hidden;
}

.pareto-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.dimension-select {
  font-size: 12px;
  padding: 3px 8px;
  border: 1px solid var(--border-color, #d1d5db);
  border-radius: 4px;
  background: var(--bg-primary, #fff);
  color: var(--text-primary, #374151);
  cursor: pointer;
  margin-left: auto;
}

.pareto-date-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #dbeafe;
  color: #1e40af;
  font-size: 12px;
  font-weight: 600;
}

.pareto-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 12px;
}

.pareto-table-wrap {
  overflow: auto;
}

.detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.detail-table th,
.detail-table td {
  border-bottom: 1px solid var(--border);
  padding: 8px 10px;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

.detail-table thead th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  z-index: 1;
}

.detail-table tbody tr:hover {
  background: #f8fbff;
}

.reason-link {
  border: none;
  background: transparent;
  color: #1d4ed8;
  cursor: pointer;
  text-decoration: underline;
  font-size: 12px;
}

.pareto-table tbody tr.active {
  background: #eff6ff;
}

.detail-table-wrap {
  position: relative;
  overflow: auto;
}

.detail-table-wrap.is-loading table {
  opacity: 0.4;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.table-loading-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.table-spinner {
  display: block;
  width: 28px;
  height: 28px;
  border: 3px solid #d1d5db;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

.detail-table .cell-nowrap {
  white-space: nowrap;
}

.detail-table .col-left {
  text-align: left;
}

.detail-table .th-expandable {
  cursor: pointer;
  user-select: none;
}

.detail-table .th-expandable:hover {
  background: #eef2f7;
}

.detail-table .expand-icon {
  font-size: 10px;
  margin-left: 2px;
  color: #64748b;
}

.detail-table .th-sub,
.detail-table .td-sub {
  background: #f8fafc;
  font-size: 11px;
  color: #475569;
}

.detail-reason-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 10px;
  padding: 2px 10px;
  border-radius: 999px;
  background: #fef2f2;
  color: #991b1b;
  font-size: 12px;
  font-weight: 600;
}

.badge-clear {
  border: 0;
  background: transparent;
  color: #991b1b;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}

/* ---- MultiSelect component styles ----
   Duplicated from resource-shared/styles.css because this page imports
   wip-shared/styles.css instead. Cannot import resource-shared directly
   due to conflicting global class names (.dashboard, .btn, etc.).
   TODO: Add <style> block to MultiSelect.vue to eliminate this duplication. ---- */

.multi-select {
  position: relative;
  min-width: 160px;
}

.multi-select-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  color: #1f2937;
  background: #ffffff;
  cursor: pointer;
}

.multi-select-trigger:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.multi-select-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}

.multi-select-arrow {
  color: #64748b;
  font-size: 11px;
}

.multi-select-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 20;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.14);
  overflow: hidden;
}

.multi-select-search {
  display: block;
  width: 100%;
  border: none;
  border-bottom: 1px solid var(--border);
  padding: 8px 12px;
  font-size: 13px;
  color: #1f2937;
  outline: none;
  background: #f8fafc;
}

.multi-select-search::placeholder {
  color: #94a3b8;
}

.multi-select-options {
  max-height: 250px;
  overflow-y: auto;
  padding: 8px 0;
}

.multi-select-option {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 12px;
  border: none;
  background: transparent;
  font-size: 13px;
  color: #334155;
  cursor: pointer;
  text-align: left;
}

.multi-select-option:hover {
  background: #f8fafc;
}

.multi-select-option input[type='checkbox'] {
  margin: 0;
  width: 14px;
  height: 14px;
  accent-color: #2563eb;
}

.multi-select-empty {
  padding: 12px;
  text-align: center;
  color: #94a3b8;
  font-size: 13px;
}

.multi-select-actions {
  display: flex;
  gap: 8px;
  padding: 8px 10px;
  border-top: 1px solid var(--border);
  background: #f8fafc;
}

.btn-sm {
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #f8fafc;
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
}

.btn-sm:hover {
  border-color: #c2d0e0;
  background: #eef4fb;
}

@media (max-width: 1400px) {
  .reject-summary-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1180px) {
  .filter-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-group-wide {
    grid-column: span 2;
  }

  .supplementary-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pareto-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .reject-summary-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-panel {
    grid-template-columns: 1fr;
  }

  .filter-group-wide {
    grid-column: span 1;
  }

  .supplementary-row {
    grid-template-columns: 1fr;
  }

  .filter-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .checkbox-row {
    flex-direction: column;
    align-items: flex-start;
  }
}
