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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f3f4f6;
  color: #111827;
  min-height: 100vh;
}

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

/* Header */
.header {
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  padding: 16px;
  margin-bottom: 24px;
}
.header h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #111827;
}
.header p {
  font-size: 0.8rem;
  color: #6b7280;
  margin-top: 2px;
}

/* Card */
.card {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  padding: 20px;
  margin-bottom: 16px;
}
.card-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #6b7280;
  margin-bottom: 14px;
}

/* Form */
label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: #374151;
  margin-bottom: 6px;
}
input[type="text"], textarea {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.9rem;
  color: #111827;
  background: #fff;
  outline: none;
  transition: border-color 0.15s;
}
input[type="text"]:focus, textarea:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
textarea { resize: vertical; min-height: 80px; }
.form-group { margin-bottom: 14px; }
.form-group:last-child { margin-bottom: 0; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  text-decoration: none;
}
.btn-primary {
  background: #2563eb;
  color: #fff;
  width: 100%;
  padding: 12px;
}
.btn-primary:hover { background: #1d4ed8; }
.btn-primary:disabled { background: #93c5fd; cursor: not-allowed; }
.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
  border-radius: 6px;
}
.btn-outline {
  background: #fff;
  border: 1px solid #d1d5db;
  color: #374151;
}
.btn-outline:hover { background: #f9fafb; }
.btn-ghost {
  background: transparent;
  color: #6b7280;
  padding: 6px 10px;
}
.btn-ghost:hover { color: #ef4444; }

/* Progress */
.progress-card { display: none; }
.progress-card.visible { display: block; }

.phase-list { list-style: none; }
.phase-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #f3f4f6;
  font-size: 0.875rem;
  color: #9ca3af;
}
.phase-item:last-child { border-bottom: none; }
.phase-item.done { color: #059669; }
.phase-item.active { color: #2563eb; font-weight: 600; }

.phase-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  background: #f3f4f6;
  color: #9ca3af;
  flex-shrink: 0;
}
.phase-item.done .phase-icon { background: #d1fae5; color: #059669; }
.phase-item.active .phase-icon { background: #dbeafe; color: #2563eb; }

.status-detail {
  font-size: 0.8rem;
  color: #6b7280;
  margin-top: 10px;
  min-height: 18px;
}

.result-link {
  display: none;
  margin-top: 12px;
  padding: 12px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
}
.result-link.visible { display: block; }
.result-link a {
  color: #059669;
  font-weight: 600;
  text-decoration: none;
  word-break: break-all;
}
.result-link a:hover { text-decoration: underline; }

/* Builds List */
.build-item {
  padding: 12px 0;
  border-bottom: 1px solid #f3f4f6;
}
.build-item:last-child { border-bottom: none; }
.build-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.build-domain {
  font-weight: 600;
  font-size: 0.9rem;
  color: #111827;
}
.build-meta {
  font-size: 0.75rem;
  color: #9ca3af;
  margin-bottom: 6px;
}
.build-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 0.7rem;
  font-weight: 600;
}
.badge-done { background: #d1fae5; color: #065f46; }
.badge-error { background: #fee2e2; color: #991b1b; }
.badge-pending, .badge-scraping, .badge-maps, .badge-analysing,
.badge-building, .badge-evaluating {
  background: #dbeafe; color: #1e40af;
}

.empty-state {
  text-align: center;
  padding: 32px;
  color: #9ca3af;
  font-size: 0.875rem;
}

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 100;
  align-items: flex-end;
  justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: #fff;
  border-radius: 16px 16px 0 0;
  padding: 24px 20px;
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 16px;
}
.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}
.modal-actions .btn { flex: 1; }

@media (min-width: 768px) {
  .modal-overlay { align-items: center; }
  .modal { border-radius: 16px; max-width: 520px; }
  .container { padding-top: 32px; }
}

/* Spinner */
@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 14px; height: 14px;
  border: 2px solid #93c5fd;
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}
