:root {
  --purple: #714b67;
  --purple-dark: #563a4d;
  --purple-light: #f3edf1;
  --ink: #1c1b1f;
  --slate: #6b6570;
  --paper: #fbfaf9;
  --card: #ffffff;
  --line: #e8e3e6;
  --green: #1c7a4b;
  --green-bg: #e8f5ee;
  --amber: #92660a;
  --amber-bg: #fdf3dd;
  --red: #a3293f;
  --red-bg: #fbe9ec;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(28, 27, 31, 0.04), 0 8px 24px rgba(28, 27, 31, 0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--purple); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1080px; margin: 0 auto; padding: 0 24px; }

/* ---------------------------------------------------------------- nav -- */

.nav {
  border-bottom: 1px solid var(--line);
  background: var(--card);
  position: sticky;
  top: 0;
  z-index: 10;
}
.nav-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--ink);
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--purple);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 800;
}
.nav-links { display: flex; align-items: center; gap: 22px; font-size: 0.92rem; }
.nav-links a { color: var(--slate); font-weight: 500; }
.nav-links a:hover { color: var(--ink); text-decoration: none; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 0.92rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
}
.btn-primary { background: var(--purple); color: white; }
.btn-primary:hover { background: var(--purple-dark); text-decoration: none; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--purple-light); text-decoration: none; }

/* --------------------------------------------------------------- hero -- */

.hero {
  padding: 76px 0 64px;
  text-align: center;
}
.eyebrow {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--purple);
  background: var(--purple-light);
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 18px;
}
.hero h1 {
  font-size: clamp(2rem, 4vw, 2.9rem);
  line-height: 1.15;
  margin: 0 0 18px;
  letter-spacing: -0.02em;
}
.hero p.lead {
  font-size: 1.15rem;
  color: var(--slate);
  max-width: 620px;
  margin: 0 auto 32px;
  line-height: 1.55;
}
.hero-ctas { display: flex; gap: 12px; justify-content: center; }
.btn-lg { padding: 13px 26px; font-size: 1rem; }

/* --------------------------------------------------------- how-it-works -- */

.section { padding: 56px 0; }
.section-head { text-align: center; margin-bottom: 44px; }
.section-head h2 { font-size: 1.7rem; margin: 0 0 10px; letter-spacing: -0.01em; }
.section-head p { color: var(--slate); font-size: 1rem; max-width: 560px; margin: 0 auto; }

.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
}
.step-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 20px;
  position: relative;
}
.step-num {
  position: absolute;
  top: 16px;
  right: 18px;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--line);
}
.step-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--purple-light);
  color: var(--purple);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}
.step-card h3 { font-size: 1rem; margin: 0 0 6px; }
.step-card p { font-size: 0.88rem; color: var(--slate); margin: 0; line-height: 1.5; }

.cta-band {
  background: var(--purple);
  border-radius: 18px;
  padding: 44px 40px;
  text-align: center;
  color: white;
}
.cta-band h2 { margin: 0 0 10px; font-size: 1.5rem; }
.cta-band p { margin: 0 0 24px; color: rgba(255,255,255,0.82); }
.cta-band .btn-primary { background: white; color: var(--purple); }
.cta-band .btn-primary:hover { background: rgba(255,255,255,0.9); }

footer.site-footer {
  border-top: 1px solid var(--line);
  padding: 28px 0;
  text-align: center;
  color: var(--slate);
  font-size: 0.85rem;
}

/* ------------------------------------------------------------- builds -- */

.page-head { padding: 40px 0 8px; display: flex; align-items: center; justify-content: space-between; }
.page-head h1 { font-size: 1.5rem; margin: 0; }
.connector-usage { color: var(--slate); font-size: 0.9rem; margin: 0; }

/* Build page, admins only: the finished build's message for the SaaS. */
.saas-box { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 22px; margin: 0 0 24px; }
.saas-box h2 { font-size: 1rem; margin: 0 0 8px; }
.saas-box .desc { color: var(--slate); font-size: 0.9rem; margin: 0 0 10px; }
.saas-sent { color: var(--green); font-size: 0.9rem; margin: 0 0 10px; }
.saas-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }

.table-wrap { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin: 24px 0 56px; }
table.builds { width: 100%; border-collapse: collapse; }
table.builds th, table.builds td { text-align: left; padding: 13px 20px; font-size: 0.92rem; }
table.builds th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--slate); border-bottom: 1px solid var(--line); }
table.builds tr:not(:last-child) td { border-bottom: 1px solid var(--line); }
table.builds tr:hover td { background: var(--purple-light); }
.empty-state { text-align: center; padding: 60px 20px; color: var(--slate); }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font-size: 0.76rem; font-weight: 700; }
.badge-pending { background: #eeecee; color: var(--slate); }
.badge-running { background: var(--amber-bg); color: var(--amber); }
.badge-done { background: var(--green-bg); color: var(--green); }
.badge-blocked { background: var(--red-bg); color: var(--red); }

/* ------------------------------------------------------------- forms --- */

.form-card { max-width: 520px; margin: 48px auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 34px; box-shadow: var(--shadow); }
.form-card h1 { font-size: 1.35rem; margin: 0 0 8px; }
.form-card .hint { color: var(--slate); font-size: 0.9rem; margin: 0 0 24px; line-height: 1.5; }
.field label { display: block; font-weight: 600; font-size: 0.88rem; margin-bottom: 6px; }
.field input[type=text], .field textarea, .field select {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 0.95rem; font-family: inherit; background: var(--paper);
}
.field input[type=text]:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--purple); background: white;
}
.field { margin-bottom: 18px; }
.error-msg { color: var(--red); font-size: 0.88rem; margin-top: 10px; }

/* The client has used their build credit: the popup (base.html) and the New
   build page (new_build.html) show the same text (_no_credit.html). */
.credit-dialog {
  border: 0; border-radius: var(--radius); padding: 0; color: var(--ink);
  width: calc(100% - 32px); max-width: 460px; box-shadow: var(--shadow);
}
.credit-dialog::backdrop { background: rgba(28, 27, 31, 0.45); }
.credit-dialog-body { padding: 30px; }
.credit-dialog h2, .credit-card h2 { font-size: 1.25rem; margin: 0 0 10px; }
.credit-dialog p, .credit-card p { color: var(--slate); font-size: 0.92rem; line-height: 1.5; margin: 0 0 22px; }
.credit-dialog-body .btn { margin-right: 8px; }

/* --------------------------------------------------------- build page -- */

.build-head { padding: 36px 0 0; }
.build-head .marketplace { font-size: 1.7rem; font-weight: 700; letter-spacing: -0.01em; }
.build-meta { display: flex; gap: 22px; color: var(--slate); font-size: 0.88rem; margin-top: 6px; flex-wrap: wrap; }
.build-meta .metric { display: flex; align-items: center; gap: 6px; }
.build-meta .metric strong { color: var(--ink); font-variant-numeric: tabular-nums; }

.progress-layout {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 20px;
  margin: 34px 0 50px;
}

.rocket-rail {
  position: relative;
  width: 4px;
  background: var(--line);
  border-radius: 4px;
  margin: 10px auto;
  justify-self: center;
}
.rocket-rail .dot {
  position: absolute;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--card);
  border: 2px solid var(--line);
}
.rocket-rail .dot.done { border-color: var(--green); background: var(--green); }
.rocket-rail .dot.running { border-color: var(--amber); background: var(--amber-bg); }
.rocket-rail .dot.blocked { border-color: var(--red); background: var(--red-bg); }
.rocket {
  position: absolute;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 30px; height: 30px;
  color: var(--purple);
  background: white;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow);
  transition: top 1.1s cubic-bezier(.4,0,.2,1);
  z-index: 2;
}

.agent-cards { display: flex; flex-direction: column; gap: 12px; }
.agent-card {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  opacity: 0.55;
  transition: opacity .3s, border-color .3s, box-shadow .3s;
}
.agent-card.is-active { opacity: 1; border-color: var(--purple); box-shadow: var(--shadow); }
.agent-card.is-done { opacity: 1; }
.agent-card.is-blocked { opacity: 1; border-color: var(--red); }
.agent-icon {
  flex: none;
  width: 40px; height: 40px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  background: var(--purple-light); color: var(--purple);
}
.agent-card.is-done .agent-icon { background: var(--green-bg); color: var(--green); }
.agent-card.is-blocked .agent-icon { background: var(--red-bg); color: var(--red); }
.agent-body { flex: 1; min-width: 0; }
.agent-row1 { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.agent-name { font-weight: 700; font-size: 0.95rem; }
.agent-line { font-size: 0.87rem; color: var(--slate); margin-top: 3px; line-height: 1.4; }
.agent-detail {
  font-size: 0.8rem; color: var(--purple); margin-top: 5px; line-height: 1.4;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--purple-light); border-radius: 6px; padding: 5px 9px;
}
.agent-fake-progress {
  margin-top: 10px; height: 5px; border-radius: 4px; background: var(--purple-light); overflow: hidden;
}
.agent-fake-progress > span {
  display: block; height: 100%; background: var(--purple); width: 0%;
  transition: width .6s ease;
}

.checkpoint-panel {
  margin-top: 12px;
  padding: 24px;
  border: 1px solid var(--purple);
  border-radius: var(--radius);
  background: var(--purple-light);
}
.checkpoint-panel h2 { font-size: 1.1rem; margin: 0 0 6px; }
.checkpoint-panel p.desc { color: var(--slate); margin: 0 0 16px; font-size: 0.92rem; }
.checkpoint-panel p.question-text { white-space: pre-wrap; margin: 0 0 16px; }

/* Grouped tick boxes (checkpoint field type "checklist"). */
.checklist-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.checklist-label { font-weight: 600; font-size: 0.88rem; }
.checklist-count { font-size: 0.82rem; color: var(--slate); font-variant-numeric: tabular-nums; }
.checklist-group {
  margin: 0 0 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--card);
}
.checklist-group[open] { padding-bottom: 8px; }
.checklist-group summary {
  display: flex; align-items: center; gap: 10px; padding: 13px 16px;
  cursor: pointer; list-style: none; border-radius: 10px; user-select: none;
}
.checklist-group summary::-webkit-details-marker { display: none; }
.checklist-group summary:hover { background: var(--purple-light); }
.checklist-group summary::after {
  content: ""; flex: none; width: 8px; height: 8px; margin: 0 4px 3px 0;
  border-right: 2px solid var(--slate); border-bottom: 2px solid var(--slate);
  transform: rotate(45deg); transition: transform .15s;
}
.checklist-group[open] summary::after { transform: rotate(-135deg); margin-bottom: -3px; }
.checklist-group[open] summary { border-bottom: 1px solid var(--line); border-radius: 10px 10px 0 0; }
.checklist-group-name { flex: 1; font-weight: 700; font-size: 0.95rem; }
.checklist-group-count {
  flex: none; padding: 2px 10px; border-radius: 999px; background: #eeecee; color: var(--slate);
  font-size: 0.78rem; font-weight: 700; font-variant-numeric: tabular-nums;
}
.checklist-group-count.has-ticked { background: var(--purple-light); color: var(--purple); }
.checklist-tools { display: flex; justify-content: flex-end; gap: 14px; padding: 8px 16px 0; }
.checklist-foot { display: flex; justify-content: center; padding: 8px 16px 2px; border-top: 1px solid var(--line); margin-top: 4px; }
.checklist-group label.check-item { margin: 0 10px; }
.link-btn { border: 0; background: none; padding: 0; color: var(--purple); font: inherit; font-size: 0.8rem; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.checklist-desc { margin: 6px 16px 2px; color: var(--slate); font-size: 0.85rem; }
.checklist label.check-item {
  display: flex; align-items: flex-start; gap: 10px; margin: 0; padding: 8px 6px;
  font-weight: 400; font-size: 0.92rem; border-radius: 6px; cursor: pointer;
}
.checklist label.check-item + label.check-item { border-top: 1px solid var(--line); }
.checklist label.check-item:hover { background: var(--purple-light); }
.check-item input { flex: none; margin: 3px 0 0; width: 16px; height: 16px; accent-color: var(--purple); }
.check-text { flex: 1; min-width: 0; }
.check-title { display: block; font-weight: 600; }
.check-id { color: var(--slate); font-weight: 500; font-variant-numeric: tabular-nums; }
.check-hint { display: block; margin-top: 2px; color: var(--slate); font-size: 0.84rem; line-height: 1.4; }
.check-tag {
  flex: none; padding: 2px 9px; border-radius: 999px; background: #eeecee; color: var(--slate);
  font-size: 0.72rem; font-weight: 700; white-space: nowrap;
}
.check-note { display: block; margin-top: 3px; color: var(--purple); font-size: 0.8rem; font-weight: 600; }
.checklist-fixed { background: transparent; border-style: dashed; }
.fixed-list { margin: 4px 0 0; padding: 0 16px 4px; list-style: none; }
.fixed-list li { padding: 7px 6px; font-size: 0.92rem; }
.fixed-list li + li { border-top: 1px solid var(--line); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

.waiting-note {
  margin: 20px 0;
  padding: 12px 16px;
  background: var(--amber-bg);
  color: var(--amber);
  border-radius: 8px;
  font-size: 0.88rem;
}

@media (max-width: 640px) {
  .progress-layout { grid-template-columns: 40px 1fr; }
  .hero-ctas { flex-direction: column; align-items: center; }
}
