:root {
  color-scheme: light;
  font-family: system-ui, sans-serif;
  background: #f5f5f5;
  color: #1f2937;
}

body {
  margin: 0;
}

[hidden] {
  display: none !important;
}

main {
  box-sizing: border-box;
  width: min(680px, calc(100% - 32px));
  margin: 48px auto;
  padding: 32px;
  border-radius: 12px;
  background: white;
  box-shadow: 0 4px 18px rgb(0 0 0 / 8%);
}

form {
  display: grid;
  gap: 16px;
  margin-top: 28px;
}

button {
  width: fit-content;
  padding: 10px 18px;
  border: 0;
  border-radius: 8px;
  background: #155eef;
  color: white;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
}

.toast-container {
  position: fixed;
  z-index: 1000;
  top: 24px;
  right: 24px;
  width: min(390px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid;
  border-radius: 12px;
  box-shadow: 0 12px 30px rgb(15 23 42 / 16%);
  color: #1e293b;
  opacity: 0;
  transform: translateX(calc(100% + 32px));
  transition: transform 320ms ease, opacity 260ms ease;
}

.toast-visible {
  opacity: 1;
  transform: translateX(0);
}

.toast-leaving {
  opacity: 0;
  transform: translateX(calc(100% + 32px));
}

.toast-success {
  border-color: #86efac;
  background: #ecfdf3;
}

.toast-error {
  border-color: #fca5a5;
  background: #fff1f2;
}

.toast-loading {
  border-color: #93c5fd;
  background: #eff6ff;
}

.toast-icon {
  display: grid;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  background: rgb(255 255 255 / 75%);
  font-weight: 800;
}

@media (prefers-reduced-motion: reduce) {
  .toast {
    transition: none;
  }
}

#uploaded-images {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

#uploaded-images img {
  width: 100%;
  height: 180px;
  max-height: 520px;
  border-radius: 8px;
  object-fit: contain;
}

.style-switch {
  display: flex;
  gap: 8px;
  margin: 16px 0;
}

.style-switch button:not(.active) {
  background: #64748b;
}

#analyze-button {
  margin-top: 20px;
}

#review-form {
  margin-top: 24px;
  padding: 20px;
  border-radius: 8px;
  background: #f3f6fc;
}

#generated-listing,
#market-result {
  margin-top: 24px;
}

#market-result {
  padding: 20px;
  border-radius: 8px;
  background: #fff8e7;
}

#market-sources {
  padding-left: 20px;
  font-size: 0.86rem;
  line-height: 1.35;
}

.market-meta {
  margin: 20px 0 0;
  color: #6b5b38;
  font-size: 0.78rem;
  font-style: italic;
}

.market-meta p {
  margin: 3px 0 0;
}

.market-meta strong {
  font-style: italic;
  font-weight: 700;
}

.market-meta span {
  font-style: italic;
  font-weight: 400;
}

.price-selector {
  margin: 22px 0;
  padding: 18px;
  border: 1px solid #ead7aa;
  border-radius: 12px;
  background: rgb(255 255 255 / 52%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 80%);
}

.price-selector-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.price-selector-heading h3 {
  margin: 0;
  font-size: 1rem;
}

.price-selector-heading span {
  color: #78673e;
  font-size: 0.8rem;
  font-weight: 700;
}

.price-scale {
  position: relative;
  margin: 24px 2px 18px;
}

#price-range {
  width: 100%;
  height: 7px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  appearance: none;
  background: linear-gradient(90deg, #d4a93b, #e1bf61, #8f742e);
}

#price-range::-webkit-slider-thumb {
  width: 22px;
  height: 22px;
  border: 3px solid white;
  border-radius: 50%;
  appearance: none;
  background: #3f3214;
  box-shadow: 0 2px 8px rgb(63 50 20 / 35%);
  cursor: grab;
}

#price-range::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: 3px solid white;
  border-radius: 50%;
  background: #3f3214;
  box-shadow: 0 2px 8px rgb(63 50 20 / 35%);
  cursor: grab;
}

.price-scale-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 7px;
  color: #6b5b38;
  font-size: 0.76rem;
  font-weight: 600;
}

.negotiable-label {
  margin: 7px 0 0;
  color: #8b2f16;
  font-size: 0.76rem;
  font-style: italic;
  text-align: center;
}

.price-input-field {
  margin-top: 16px;
}

.price-input-wrap {
  position: relative;
}

.price-input-wrap input {
  padding-right: 64px;
  font-size: 1.1rem;
  font-weight: 750;
}

.price-input-wrap span {
  position: absolute;
  top: 50%;
  right: 12px;
  color: #78673e;
  font-size: 0.82rem;
  font-weight: 700;
  transform: translateY(-50%);
}

#generated-listing {
  padding: 20px;
  border-radius: 8px;
  background: #eefbf3;
}

.product-information {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #e8edf4;
}

.product-information-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 2px 5px;
}

.product-information-heading h3 {
  margin: 0;
  font-size: 1.05rem;
}

.product-information-heading span {
  padding: 3px 8px;
  border-radius: 999px;
  background: #cbd5e1;
  color: #475569;
  font-size: 0.75rem;
  font-weight: 600;
}

.product-information > div {
  padding: 12px 14px;
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #f1f5f9;
  color: #475569;
}

.product-information > .product-information-heading {
  border: 0;
  background: transparent;
  color: #1f2937;
}

.product-information p {
  margin: 5px 0 0;
  white-space: pre-line;
  line-height: 1.45;
}

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

.copy-field {
  display: grid;
  gap: 4px;
}

.listing-field + .listing-field {
  margin-top: 18px;
}

.icon-copy {
  display: grid;
  width: 26px;
  height: 26px;
  padding: 0;
  place-items: center;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: white;
  color: #334155;
  font-size: 0.95rem;
  line-height: 1;
}

.icon-copy:hover {
  border-color: #155eef;
  color: #155eef;
}

input,
textarea {
  box-sizing: border-box;
  width: 100%;
  padding: 9px 11px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font: inherit;
}

textarea {
  resize: vertical;
}

.field-help {
  margin: -10px 0 0;
  color: #475569;
  font-size: 0.9rem;
  line-height: 1.45;
}

.uncertainty-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-weight: 700;
}

.uncertainty-heading small {
  color: #64748b;
  font-weight: 400;
}

.uncertainty-list {
  display: grid;
  gap: 10px;
}

.uncertainty-item {
  overflow: hidden;
  border: 1px solid #fecaca;
  border-radius: 9px;
  background: #fff7f7;
}

.uncertainty-item.resolved {
  border-color: #86efac;
  background: #f0fdf4;
}

.uncertainty-summary {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 0;
  background: transparent;
  color: #7f1d1d;
  text-align: left;
}

.uncertainty-item.resolved .uncertainty-summary {
  color: #166534;
}

.uncertainty-summary strong {
  flex: 0 0 auto;
  font-size: 0.82rem;
}

.uncertainty-editor {
  display: grid;
  gap: 10px;
  padding: 0 14px 14px;
}

.uncertainty-actions {
  display: flex;
  gap: 8px;
}

.secondary-button {
  background: #64748b;
}

@media (max-width: 560px) {
  .toast-container {
    top: 12px;
    right: 16px;
  }

  .uncertainty-heading,
  .uncertainty-summary {
    align-items: stretch;
    flex-direction: column;
  }
}

dt {
  margin-top: 12px;
  font-weight: 700;
}

dd {
  margin-left: 0;
}
