:root {
  --wizard-border: #e4e7ec;
  --wizard-muted: #475467;
  --wizard-bg: #f9fafb;
}

.lookup-wizard {
  margin: 32px 0;
  padding: 24px;
  background: #fff;
  border: 1px solid var(--wizard-border);
  border-radius: 20px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.wizard-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.wizard-heading h2 {
  margin: 0;
  font-size: 1.5rem;
}

.wizard-heading p {
  margin: 4px 0 0 0;
  color: var(--wizard-muted);
  max-width: 520px;
}

.wizard-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.wizard-hint {
  font-size: 0.85rem;
  color: var(--wizard-muted);
}

.muted {
  color: var(--wizard-muted);
  font-size: 0.85rem;
}

.btn-secondary {
  border: 1px solid #d0d5dd;
  background: #fff;
  border-radius: 10px;
  padding: 8px 16px;
  font-weight: 600;
  cursor: pointer;
  color: #1d4ed8;
}

.btn-secondary:hover {
  background: #f8fafc;
}

.party-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
  margin-top: 24px;
}

.party-panel {
  border: 1px solid var(--wizard-border);
  border-radius: 16px;
  padding: 18px;
  background: var(--wizard-bg);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.party-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.party-header h3 {
  margin: 0;
  font-size: 1.2rem;
}

.party-header p {
  margin: 4px 0 0 0;
  color: var(--wizard-muted);
  font-size: 0.85rem;
}

.progress-chip {
  align-self: center;
  background: #eef2ff;
  color: #312e81;
  border-radius: 999px;
  padding: 4px 12px;
  font-weight: 600;
  font-size: 0.85rem;
}

.input-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.9rem;
}

.input-field textarea,
.input-field input,
.input-field select {
  border: 1px solid #d0d5dd;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.95rem;
  background: #fff;
}

.input-field textarea {
  resize: vertical;
}

.dropzone {
  position: relative;
  border: 1px dashed #d0d5dd;
  border-radius: 12px;
  background: #fff;
  padding: 16px;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.dropzone.dragover {
  border-color: #6366f1;
  background: #eef2ff;
}

.dropzone.has-files {
  border-color: #4f46e5;
  background: #f5f3ff;
}

.dropzone .dz-cta {
  pointer-events: none;
  color: var(--wizard-muted);
  text-align: left;
}

.thumb-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(64px, 1fr));
  gap: 8px;
}

.thumb-grid[hidden] {
  display: none !important;
}

.thumb-grid .thumb {
  position: relative;
  width: 100%;
  padding-top: 135%;
  border-radius: 10px;
  overflow: hidden;
  background: #f4f4f5;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.05);
}

.thumb-grid .thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb-preview {
  border: none;
  padding: 0;
  background: transparent;
  width: 100%;
  height: 100%;
  cursor: zoom-in;
  display: block;
  border-radius: 10px;
  overflow: hidden;
}

.thumb-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumb-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  border: none;
  background: rgba(15, 23, 42, 0.75);
  color: #fff;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.party-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.party-status {
  min-height: 1.2em;
  font-size: 0.85rem;
  color: var(--wizard-muted);
}

.party-status[data-tone="success"] {
  color: #15803d;
}

.party-status[data-tone="warn"] {
  color: #b45309;
}

.party-status[data-tone="error"] {
  color: #b91c1c;
}

.party-results {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stage-card {
  border: 1px solid #d7dbe7;
  border-radius: 14px;
  background: #fff;
  padding: 14px;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.07);
}

.stage-card header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
}

.stage-product {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 10px;
}

.stage-card h4 {
  margin: 0;
  font-size: 1rem;
}

.stage-card small {
  color: var(--wizard-muted);
}

.stage-card.loading {
  opacity: 0.6;
  pointer-events: none;
}

.candidate-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.candidate-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

.btn-tertiary {
  border: none;
  background: transparent;
  color: var(--trade-accent, #136fdf);
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
}

.btn-tertiary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.candidate-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid #eceff5;
  border-radius: 12px;
  padding: 10px 12px;
  background: #fdfdfd;
}

.candidate-meta {
  display: flex;
  text-align: left;
  gap: 4px;
}

.candidate-meta span {
  font-weight: 600;
}

.candidate-meta small {
  color: var(--wizard-muted);
  font-size: 0.75rem;
}

.variant-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 8px;
}

.variant-controls label {
  font-size: 0.85rem;
  color: var(--wizard-muted);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.variant-controls select {
  border: 1px solid #d0d5dd;
  border-radius: 10px;
  padding: 8px 10px;
  background: #fff;
}

.variant-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
  font-size: 0.9rem;
}

.variant-table th,
.variant-table td {
  border-bottom: 1px solid #edf0f5;
  padding: 8px 6px;
  text-align: left;
}

.variant-table th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
}

.variant-table button {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid #6366f1;
  background: #eef2ff;
  color: #312e81;
  font-weight: 600;
  cursor: pointer;
}

.variant-table button:hover {
  background: #e0e7ff;
}

.approx-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid #facc15;
  background: #fef9c3;
  font-size: 0.7rem;
  color: #92400e;
  margin-left: 6px;
}

.empty-state-card {
  padding: 12px;
  border-radius: 12px;
  border: 1px dashed #d4d4d8;
  background: #f8fafc;
  font-size: 0.9rem;
  color: var(--wizard-muted);
}

.party-selected {
  border-top: 1px solid #e4e7ec;
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.selected-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.badge {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  background: #ecfccb;
  color: #3f6212;
}

.selected-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.selected-list li {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  background: #fff;
}

.selected-list button {
  border: none;
  background: none;
  color: #b91c1c;
  font-size: 0.9rem;
  cursor: pointer;
}

.selected-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  flex: 1;
}

.selected-thumb {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
}

.selected-thumb img,
.selected-thumb button {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  overflow: hidden;
}

.selected-details {
  flex: 1;
  min-width: 0;
}

.selected-details .muted {
  color: var(--wizard-muted);
  font-size: 0.85rem;
  word-break: break-word;
}

.selected-price {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.selected-price .approx-chip {
  font-size: 0.7rem;
  margin-left: 6px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3;
}

.price-override {
  display: flex;
  flex-direction: column;
  font-size: 0.75rem;
  color: var(--wizard-muted);
}

.price-override input {
  border: 1px solid #d4d4d8;
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 0.85rem;
  width: 120px;
}

@media (max-width: 640px) {
  .selected-list li {
    flex-direction: column;
    align-items: flex-start;
  }

  .selected-card {
    width: 100%;
    flex-direction: column;
  }

  .selected-price {
    flex-direction: column;
    align-items: stretch;
  }

  .price-override input {
    width: 100%;
  }

  .selected-list button {
    align-self: flex-end;
    font-size: 0.85rem;
  }
}

.totals-line {
  font-weight: 600;
  font-size: 0.95rem;
}

.party-summary {
  margin-top: 28px;
  border: 1px solid var(--wizard-border);
  border-radius: 16px;
  padding: 16px;
  background: #fff;
}

.party-summary h3 {
  margin: 0 0 12px 0;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 0.95rem;
}

.summary-value {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.summary-override {
  display: flex;
  flex-direction: column;
  font-size: 0.8rem;
  color: var(--wizard-muted);
  text-align: right;
  gap: 4px;
}

.summary-override input {
  width: 140px;
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 0.85rem;
  text-align: right;
}

.summary-row strong {
  font-size: 1rem;
}

.summary-row.difference strong[data-direction="positive"] {
  color: #15803d;
}

.summary-row.difference strong[data-direction="negative"] {
  color: #b91c1c;
}

.dev-console {
  margin-top: 16px;
  border: 1px dashed #d4d4d8;
  border-radius: 12px;
  padding: 10px;
  background: #fdfdf6;
}

.dev-console pre {
  margin: 0;
  max-height: 220px;
  overflow: auto;
  font-size: 0.8rem;
}

.legacy-trade[hidden] {
  display: none !important;
}

.image-preview-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.85);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 9999;
}

.image-preview-overlay.open {
  display: flex;
}

.image-preview-content {
  position: relative;
  max-width: min(90vw, 720px);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.image-preview-content img {
  max-width: 100%;
  max-height: 75vh;
  border-radius: 16px;
  box-shadow: 0 12px 50px rgba(0, 0, 0, 0.6);
}

.image-preview-label {
  color: #f1f5f9;
  font-weight: 600;
  text-align: center;
}

.image-preview-close {
  position: absolute;
  top: -12px;
  right: -12px;
  border: none;
  background: rgba(15, 23, 42, 0.9);
  color: #fff;
  font-size: 1.5rem;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  cursor: pointer;
}

body.preview-open {
  overflow: hidden;
}

.skeleton-block {
  height: 16px;
  width: 100%;
  background: linear-gradient(90deg, #f1f5f9, #e2e8f0, #f1f5f9);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
  border-radius: 6px;
  margin-bottom: 6px;
}

.dz-actions {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dz-btn {
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  padding: 6px 12px;
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.dz-btn-upload {
  color: #111827;
}

.dz-btn-camera {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

/* Optionally hide camera button on desktop if you want it to read as a mobile affordance */
@media (min-width: 768px) {
  .dz-btn-camera {
    display: none;
  }
}


@keyframes shimmer {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: -200% 50%;
  }
}
