:root {
  --navy: #1E2761;
  --navy-light: #E8EEF8;
  --navy-mid: #2A3580;
  --amber: #C47A1A;
  --amber-light: #FFF8EC;
  --teal: #0D6B6B;
  --teal-light: #E0F4F4;
  --green: #1B5E20;
  --green-light: #E8F5E9;
  --red: #B71C1C;
  --red-light: #FFEBEE;
  --ink: #1A1A2E;
  --muted: #6B7280;
  --light: #F5F6FA;
  --white: #FFFFFF;
  --border: #CBD0E8;
  --radius: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'DM Sans', -apple-system, sans-serif;
  background: var(--light);
  color: var(--ink);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

.header {
  background: var(--navy);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header h1 {
  font-family: 'DM Serif Display', serif;
  color: var(--white);
  font-size: 22px;
  font-weight: normal;
}

.header h1 span { color: var(--amber); }

.header-badge {
  background: rgba(255,255,255,0.15);
  color: var(--white);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
}

.container {
  max-width: 500px;
  margin: 0 auto;
  padding: 16px;
}

/* --- Upload Areas --- */
.upload-section {
  background: var(--white);
  border-radius: var(--radius);
  border: 2px dashed var(--border);
  padding: 20px;
  text-align: center;
  margin-bottom: 12px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.upload-section:hover { border-color: var(--navy); background: var(--navy-light); }
.upload-section.has-files { border-style: solid; border-color: var(--green); background: var(--green-light); }

.upload-icon { font-size: 32px; margin-bottom: 8px; }
.upload-title { font-size: 15px; font-weight: 600; color: var(--ink); }
.upload-hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

.file-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  justify-content: flex-start;
}

.file-thumb {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--border);
}

.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
  color: var(--ink);
}

.file-remove {
  cursor: pointer;
  color: var(--red);
  font-weight: 700;
  font-size: 14px;
}

/* --- Form --- */
.form-section {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 20px;
  margin-bottom: 12px;
}

.form-section h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 14px;
}

.field { margin-bottom: 14px; }

.field label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 4px;
}

.field-hint { font-weight: 400; color: var(--muted); font-size: 12px; }

.field input, .field select, .field textarea {
  width: 100%;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
}

.field textarea { resize: vertical; min-height: 60px; }

.condition-options { display: flex; gap: 6px; flex-wrap: wrap; }

.condition-btn {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--white);
  font-family: inherit;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.15s;
}

.condition-btn:hover { border-color: var(--navy); }
.condition-btn.active { background: var(--navy); color: var(--white); border-color: var(--navy); }

/* --- Photo suggestions --- */
.photo-tips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.photo-tip {
  font-size: 11px;
  padding: 3px 8px;
  background: var(--amber-light);
  color: var(--amber);
  border-radius: 12px;
}

/* --- Submit --- */
.submit-btn {
  display: block;
  width: 100%;
  padding: 16px;
  background: var(--navy);
  color: var(--white);
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.2s;
  margin-bottom: 12px;
}

.submit-btn:hover { background: var(--navy-mid); }
.submit-btn:disabled { opacity: 0.4; cursor: default; }

/* --- Error --- */
.error-box {
  background: var(--red-light);
  color: var(--red);
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 12px;
  display: none;
}

.error-box.active { display: block; }

/* --- Loading --- */
.loading-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(30,39,97,0.95);
  z-index: 200;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--white);
}

.loading-overlay.active { display: flex; }

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(255,255,255,0.2);
  border-top-color: var(--amber);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 20px;
}

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

.loading-text { font-size: 18px; font-weight: 600; margin-bottom: 24px; }

.loading-steps { display: flex; flex-direction: column; gap: 8px; }

.loading-step-item {
  font-size: 14px;
  color: rgba(255,255,255,0.5);
  transition: color 0.3s;
}

.loading-step-item.active { color: var(--white); }

.step-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
  margin-right: 8px;
  vertical-align: middle;
}

.loading-step-item.active .step-dot { background: var(--amber); }

/* --- Result --- */
.result-section { display: none; }
.result-section.active { display: block; }

.section {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 16px;
  margin-bottom: 12px;
}

.section-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
}

.bike-chips { display: flex; flex-wrap: wrap; gap: 6px; }

.bike-chip {
  font-size: 13px;
  padding: 4px 12px;
  background: var(--navy-light);
  color: var(--navy);
  border-radius: 16px;
  font-weight: 500;
}

/* --- Price corridors --- */
.ek-corridor, .vk-corridor {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.price-card {
  flex: 1;
  text-align: center;
  padding: 12px 4px;
  border-radius: 8px;
  background: var(--light);
}

.price-card.recommended { background: var(--navy); color: var(--white); }
.price-card.ek-recommended { background: var(--teal); color: var(--white); }

.price-label { font-size: 11px; color: var(--muted); }
.price-card.recommended .price-label, .price-card.ek-recommended .price-label { color: rgba(255,255,255,0.7); }

.price-value { font-size: 20px; font-weight: 700; margin-top: 2px; }
.price-card.recommended .price-value, .price-card.ek-recommended .price-value { color: var(--white); font-size: 24px; }

/* --- Market data --- */
.market-box {
  background: var(--teal-light);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 8px;
}

.market-box .market-title { font-size: 12px; font-weight: 600; color: var(--teal); margin-bottom: 6px; }
.market-stat { font-size: 14px; color: var(--ink); }
.market-stat strong { font-weight: 700; }

/* --- Confidence --- */
.confidence-badge {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  padding: 4px 14px;
  border-radius: 16px;
  margin-top: 8px;
}

.confidence-badge.high { background: var(--green-light); color: var(--green); }
.confidence-badge.medium { background: var(--amber-light); color: var(--amber); }
.confidence-badge.estimate { background: var(--light); color: var(--muted); }

/* --- Reasoning / factors --- */
.reasoning-box {
  background: var(--light);
  border-radius: 8px;
  padding: 12px 14px;
  border-left: 3px solid var(--navy);
}

.reasoning-title { font-size: 12px; font-weight: 600; color: var(--navy); margin-bottom: 6px; }
.reasoning-text { font-size: 14px; line-height: 1.5; color: var(--ink); }

.market-factors { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

.factor-tag {
  font-size: 12px;
  padding: 4px 10px;
  background: var(--teal-light);
  color: var(--teal);
  border-radius: 12px;
}

.warn-box {
  background: var(--amber-light);
  border-left: 3px solid var(--amber);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 8px;
}

.warn-item { font-size: 14px; color: var(--amber); margin-bottom: 4px; }

.new-eval-btn {
  display: block;
  width: 100%;
  padding: 14px;
  background: var(--navy-light);
  color: var(--navy);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  margin-bottom: 12px;
}

.footer {
  text-align: center;
  padding: 16px;
  font-size: 12px;
  color: var(--muted);
}

/* --- Source hints + conflict UI --- */
.source-hint { display: none; margin-top: 4px; padding: 6px 10px; border-radius: 6px; font-size: 12px; line-height: 1.4; }
.source-hint.visible { display: block; }
.source-hint.prefilled { background: var(--green-light); color: var(--green); }
.source-hint.conflict { background: var(--amber-light); color: var(--amber); }
.source-hint .adopt-btn {
  display: inline-block; margin-left: 8px; padding: 2px 10px; font-size: 12px; font-weight: 600;
  color: var(--navy); background: var(--white); border: 1px solid var(--border); border-radius: 4px; cursor: pointer;
}
.source-hint .adopt-btn:hover { background: var(--navy-light); }

/* --- Analysis badges --- */
.doc-status { font-size: 11px; margin-left: 6px; }
.doc-status.loading { color: var(--amber); }
.doc-status.done { color: var(--green); }
.doc-status.error { color: var(--red); }

.photo-analysis-banner {
  margin-top: 8px; padding: 6px 10px; border-radius: 6px;
  font-size: 12px; background: var(--teal-light); color: var(--teal);
}

@media (max-width: 400px) {
  .price-value { font-size: 16px; }
  .price-card.recommended .price-value, .price-card.ek-recommended .price-value { font-size: 20px; }
}
