:root {
  --bg: #f5f5f0;
  --surface: #ffffff;
  --border: #e2e2dc;
  --text: #1a1a1a;
  --text-muted: #6b6b6b;
  --accent: #1a3fa0;
  --accent-light: #e8edf8;
  --green: #16a34a;
  --green-bg: #dcfce7;
  --yellow: #a16207;
  --yellow-bg: #fef9c3;
  --gray: #6b6b6b;
  --gray-bg: #f4f4f4;
  --red: #dc2626;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

/* ── Layout ── */
.page {
  max-width: 760px;
  margin: 0 auto;
  padding: 48px 24px 80px;
}

/* ── Header ── */
header {
  text-align: center;
  margin-bottom: 40px;
}

.logo-mark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.logo-mark svg { width: 18px; height: 18px; }

h1 {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 8px;
}

.tagline {
  font-size: 15px;
  color: var(--text-muted);
  max-width: 480px;
  margin: 0 auto;
}

/* ── Input Section ── */
.input-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  margin-bottom: 32px;
}

.input-row {
  display: flex;
  gap: 10px;
}

#company-input {
  flex: 1;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 15px;
  color: var(--text);
  background: var(--bg);
  outline: none;
  transition: border-color 0.15s;
}

#company-input:focus { border-color: var(--accent); background: white; }
#company-input::placeholder { color: #aaa; }

#submit-btn {
  height: 44px;
  padding: 0 20px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.15s;
}

#submit-btn:hover { opacity: 0.88; }
#submit-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.examples {
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-muted);
}

.examples span { font-weight: 500; }

.example-link {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 12px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: background 0.1s;
}
.example-link:hover { background: var(--accent-light); }

/* ── Agent Feed ── */
#agent-feed {
  display: none;
  margin-bottom: 32px;
}

#agent-feed.visible { display: block; }

.feed-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.agent-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 8px;
  box-shadow: var(--shadow);
  animation: slideIn 0.2s ease;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.agent-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  margin-top: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

.icon-done { color: var(--green); }
.icon-skip { color: var(--yellow); }
.icon-error { color: var(--red); }

.agent-info { flex: 1; min-width: 0; }

.agent-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.agent-desc {
  font-size: 13px;
  color: var(--text-muted);
}

/* ── Report Card ── */
#report {
  display: none;
}

#report.visible { display: block; }

.report-header {
  margin-bottom: 24px;
}

.report-company {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}

.report-domain {
  font-size: 13px;
  color: var(--text-muted);
}

.report-summary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 16px 18px;
  font-size: 14px;
  color: var(--text);
  line-height: 1.6;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}

/* ── Stack Categories ── */
.stack-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

@media (max-width: 560px) { .stack-grid { grid-template-columns: 1fr; } }

.stack-category {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.stack-category:first-child {
  grid-column: 1 / -1; /* Full width for Backend — usually richest */
}

.category-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.category-icon { font-size: 14px; }

.tech-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tech-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
}

.tech-badge.high {
  background: var(--green-bg);
  color: var(--green);
}

.tech-badge.medium {
  background: var(--yellow-bg);
  color: var(--yellow);
}

.tech-badge.low {
  background: var(--gray-bg);
  color: var(--gray);
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.high .badge-dot { background: var(--green); }
.medium .badge-dot { background: #eab308; }
.low .badge-dot { background: #9ca3af; }

.empty-category {
  font-size: 13px;
  color: #bbb;
  font-style: italic;
}

/* ── Sources Row ── */
.sources-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.source-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 12px;
  color: var(--text-muted);
  box-shadow: var(--shadow);
}

.source-chip .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
}

.source-chip .dot.inactive { background: #ddd; }

/* ── Confidence Legend ── */
.legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

/* ── Error state ── */
#error-msg {
  display: none;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 14px;
  color: var(--red);
  margin-bottom: 24px;
}

#error-msg.visible { display: block; }

/* ── Next Steps ── */
#actions {
  display: none;
  margin-top: 32px;
}

#actions.visible { display: block; }

.next-steps-header {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.next-steps-header span { font-size: 20px; }

.action-section {
  margin-bottom: 28px;
}

.action-section-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* Build This cards */
.build-cards { display: flex; flex-direction: column; gap: 12px; }

.build-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}

.build-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.build-card-why {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 10px;
}

.build-card-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.stack-tag {
  background: var(--accent-light);
  color: var(--accent);
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
}

/* Reach Out cards */
.person-cards { display: flex; flex-direction: column; gap: 10px; }

.person-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}

.person-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--border);
  object-fit: cover;
}

.person-info { flex: 1; min-width: 0; }

.person-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 3px;
}

.person-why {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 8px;
}

.person-links {
  display: flex;
  gap: 10px;
}

.person-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--accent-light);
  transition: opacity 0.1s;
}

.person-link:hover { opacity: 0.75; }

/* Problem cards */
.problem-cards { display: flex; flex-direction: column; gap: 10px; }

.problem-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--yellow);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}

.problem-signal {
  font-size: 12px;
  font-weight: 600;
  color: var(--yellow);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 5px;
}

.problem-inference {
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
}

/* ── Footer ── */
footer {
  text-align: center;
  margin-top: 48px;
  font-size: 12px;
  color: #bbb;
}
