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

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

.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 32px 20px;
}

header {
  text-align: center;
  margin-bottom: 36px;
}

header h1 {
  font-size: 28px;
  font-weight: 700;
  color: #1a1a2e;
}

header p {
  color: #6b7280;
  margin-top: 6px;
  font-size: 15px;
}

.card {
  background: #fff;
  border-radius: 14px;
  padding: 28px;
  margin-bottom: 20px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.section-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #9ca3af;
  margin-bottom: 16px;
}

label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  color: #374151;
  margin-bottom: 6px;
  margin-top: 16px;
}

label:first-of-type { margin-top: 0; }

input[type="text"], input[type="url"] {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid #e5e7eb;
  border-radius: 8px;
  font-size: 15px;
  color: #1a1a2e;
  outline: none;
  transition: border-color 0.2s;
}

input[type="text"]:focus, input[type="url"]:focus {
  border-color: #4f46e5;
}

/* Tag input */
.tag-input-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 10px;
  border: 1.5px solid #e5e7eb;
  border-radius: 8px;
  cursor: text;
  min-height: 44px;
  align-items: center;
  transition: border-color 0.2s;
}

.tag-input-wrap:focus-within { border-color: #4f46e5; }

.tag-input-wrap input {
  border: none;
  outline: none;
  font-size: 14px;
  flex: 1;
  min-width: 120px;
  padding: 2px 4px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
}

.tag-blue { background: #eff6ff; color: #2563eb; }
.tag-green { background: #f0fdf4; color: #16a34a; }

.tag-remove {
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  opacity: 0.6;
}
.tag-remove:hover { opacity: 1; }

/* Competitors */
.competitors-grid {
  display: grid;
  gap: 10px;
}

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

.competitor-badge {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.badge-blue { background: #3b82f6; }
.badge-green { background: #22c55e; }
.badge-red { background: #ef4444; }

/* Team */
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.team-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 12px;
  background: #f9fafb;
  border-radius: 10px;
  gap: 8px;
}

.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.team-name {
  font-size: 14px;
  font-weight: 600;
}

.team-role {
  font-size: 12px;
  color: #6b7280;
  text-align: center;
  background: none;
  border: none;
  border-bottom: 1px dashed #d1d5db;
  width: 100%;
  text-align: center;
  padding: 2px 4px;
  outline: none;
  cursor: text;
}

.team-role:focus { border-bottom-color: #4f46e5; }

/* Slider */
.slider-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
}

input[type="range"] {
  flex: 1;
  accent-color: #4f46e5;
  height: 6px;
}

.slider-value {
  font-size: 18px;
  font-weight: 700;
  color: #4f46e5;
  min-width: 50px;
  text-align: right;
}

/* Submit button */
.btn-generate {
  width: 100%;
  padding: 16px;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.1s;
  margin-top: 8px;
}

.btn-generate:hover { opacity: 0.92; }
.btn-generate:active { transform: scale(0.99); }
.btn-generate:disabled { opacity: 0.5; cursor: not-allowed; }

/* Progress section */
#progress-section { display: none; }

.agents-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.agent-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: #f9fafb;
  border-radius: 10px;
  border: 1.5px solid #e5e7eb;
  transition: all 0.3s;
}

.agent-card.working {
  border-color: #f59e0b;
  background: #fffbeb;
}

.agent-card.done {
  border-color: #22c55e;
  background: #f0fdf4;
}

.agent-icon { font-size: 20px; }

.agent-info { flex: 1; }
.agent-name { font-size: 13px; font-weight: 600; }
.agent-status { font-size: 11px; color: #9ca3af; margin-top: 2px; }

.agent-card.working .agent-status { color: #d97706; }
.agent-card.done .agent-status { color: #16a34a; }

/* Progress bar */
.progress-bar-wrap {
  background: #e5e7eb;
  border-radius: 8px;
  height: 10px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #4f46e5, #7c3aed);
  border-radius: 8px;
  transition: width 0.4s ease;
  width: 0%;
}

.progress-text {
  font-size: 14px;
  color: #6b7280;
  text-align: center;
}

/* Result section */
#result-section { display: none; }

.result-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: #f9fafb;
  border-radius: 10px;
  padding: 16px;
  text-align: center;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: #4f46e5;
}

.stat-label {
  font-size: 12px;
  color: #9ca3af;
  margin-top: 4px;
}

.result-buttons {
  display: flex;
  gap: 12px;
}

.btn-pdf {
  flex: 1;
  padding: 14px;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn-pdf:hover { opacity: 0.9; }

.btn-pdf.btn-outline {
  background: #fff;
  color: #4f46e5;
  border: 2px solid #4f46e5;
}
.btn-pdf.btn-outline:hover { background: #f5f3ff; }

.btn-pdf:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-positions {
  width: 100%;
  padding: 12px 16px;
  background: linear-gradient(135deg, #059669, #10b981);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}
.btn-positions:hover { opacity: 0.9; }
.btn-positions:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-reset {
  padding: 14px 20px;
  background: #f3f4f6;
  color: #374151;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-reset:hover { background: #e5e7eb; }

/* Manager select */
.manager-select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid #e5e7eb;
  border-radius: 8px;
  font-size: 15px;
  color: #1a1a2e;
  background: #fff;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236b7280' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}
.manager-select:focus { border-color: #4f46e5; }

.manager-preview-card {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
  padding: 12px 16px;
  background: #f8fafd;
  border-radius: 12px;
  border: 1.5px solid #e5e7eb;
}
.manager-preview-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}
.manager-preview-name {
  font-size: 15px;
  font-weight: 700;
  color: #1a1a2e;
}
.manager-preview-role {
  font-size: 13px;
  color: #6b7280;
  margin-top: 2px;
}

/* Error */
.error-msg {
  background: #fef2f2;
  color: #dc2626;
  padding: 14px;
  border-radius: 10px;
  font-size: 14px;
  display: none;
}
