:root {
  --bg: #F5F4EF;
  --surface: #FFFFFF;
  --surface-inset: #F2F0E7;
  --pitch-bg: #EEF4EC;
  --decision-bg: #FAF3DF;
  --answered-bg: #E2EEE5;
  --ink: #16261F;
  --text-secondary: #3A3D33;
  --text-muted: #6E7168;
  --text-faint: #79806F;
  --border: rgba(28,30,22,0.08);
  --border-strong: rgba(28,30,22,0.15);
  --green: #235440;
  --green-text: #F1EFE6;
  --gold: #8A6D2F;
  --running: #159F63;
  --waiting: #B27A1C;
  --waiting-card: #FBF6EA;
  --idle-dot: #C6C3B4;
  --risk: #B4472F;
  --reasoning: #8C6BB1;
  --wrap: 880px;
  --pad: 24px;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding-left: max(var(--pad), env(safe-area-inset-left));
  padding-right: max(var(--pad), env(safe-area-inset-right));
}

/* Header / nav */
header.site {
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(1.2) blur(10px);
  -webkit-backdrop-filter: saturate(1.2) blur(10px);
  position: sticky;
  top: 0;
  z-index: 20;
}
header.site .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 14px;
  padding-bottom: 14px;
  min-height: 56px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 17px;
  color: var(--ink);
  flex-shrink: 0;
  white-space: nowrap;
}
.brand a {
  color: inherit;
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.brand .mark {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--green);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--green-text);
  font-weight: 800;
  font-size: 13px;
  flex-shrink: 0;
}
nav.site-nav {
  display: flex;
  gap: 18px;
  align-items: center;
  flex-wrap: nowrap;
  min-width: 0;
}
nav.site-nav a {
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  padding: 8px 2px;
}
nav.site-nav a.cta {
  background: var(--green);
  color: var(--green-text);
  padding: 9px 14px;
  border-radius: 9px;
  font-weight: 700;
  line-height: 1.2;
}
nav.site-nav a.cta:hover { text-decoration: none; opacity: 0.92; }

/* Mobile menu toggle (checkbox hack, no JS) */
.nav-toggle { display: none; }
.nav-toggle-label {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.nav-toggle-label span,
.nav-toggle-label span::before,
.nav-toggle-label span::after {
  display: block;
  width: 16px;
  height: 2px;
  background: var(--ink);
  border-radius: 1px;
  position: relative;
  transition: transform .15s ease, opacity .15s ease;
}
.nav-toggle-label span::before,
.nav-toggle-label span::after {
  content: "";
  position: absolute;
  left: 0;
}
.nav-toggle-label span::before { top: -5px; }
.nav-toggle-label span::after { top: 5px; }
.nav-toggle:checked + .nav-toggle-label span { background: transparent; }
.nav-toggle:checked + .nav-toggle-label span::before {
  top: 0;
  transform: rotate(45deg);
}
.nav-toggle:checked + .nav-toggle-label span::after {
  top: 0;
  transform: rotate(-45deg);
}
/* Keep the two bars visible while forming the X */
.nav-toggle:checked + .nav-toggle-label span::before,
.nav-toggle:checked + .nav-toggle-label span::after {
  background: var(--ink);
}

/* Hero */
.hero {
  padding: 72px 0 56px;
  text-align: center;
}
.hero .eyebrow {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-size: 11px;
  font-weight: 700;
  color: var(--green);
  margin-bottom: 14px;
}
.hero h1 {
  font-size: clamp(28px, 7vw, 44px);
  font-weight: 800;
  letter-spacing: -0.5px;
  margin: 0 0 16px;
  line-height: 1.12;
  text-wrap: balance;
}
.hero p.lede {
  font-size: 17px;
  color: var(--text-secondary);
  max-width: 34em;
  margin: 0 auto 28px;
  line-height: 1.55;
  text-wrap: pretty;
}
.hero .actions,
.actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 20px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 15px;
  min-height: 44px; /* touch target */
  line-height: 1.2;
}
.btn-primary { background: var(--green); color: var(--green-text); }
.btn-primary:hover { text-decoration: none; opacity: 0.92; }
.btn-secondary {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border-strong);
}
.btn-secondary:hover { text-decoration: none; background: var(--surface-inset); }

/* Cards / sections */
section { padding: 48px 0; }
section.alt {
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

h2 {
  font-size: clamp(22px, 5vw, 28px);
  font-weight: 800;
  letter-spacing: -0.3px;
  margin: 0 0 8px;
  text-wrap: balance;
}
h2.center { text-align: center; }
p.section-sub {
  color: var(--text-muted);
  margin: 0 0 28px;
  font-size: 15px;
}
p.section-sub.center { text-align: center; }

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  min-width: 0;
}
.card h3 {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.55;
}
.card .icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  font-size: 17px;
}
.icon.pitch { background: var(--pitch-bg); }
.icon.decision { background: var(--decision-bg); }
.icon.status { background: var(--answered-bg); }

/* Status dots */
.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 8px;
  vertical-align: middle;
  flex-shrink: 0;
}
.dot.running { background: var(--running); box-shadow: 0 0 0 3px rgba(21,159,99,0.18); }
.dot.waiting { background: var(--waiting); box-shadow: 0 0 0 3px rgba(178,122,28,0.18); }
.dot.idle { background: var(--idle-dot); }
.dot.risk { background: var(--risk); }
.dot.reasoning { background: var(--reasoning); }

/* Stacked status legend (replaces one-liner) */
.status-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.status-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.4;
}
.status-list .status-name {
  color: var(--ink);
  font-weight: 700;
  min-width: 4.5em;
  flex-shrink: 0;
}
.status-list .more {
  margin-top: 4px;
  font-weight: 600;
}

.indicator-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.indicator-row:last-child { border-bottom: none; }
.indicator-row .label {
  min-width: 170px;
  font-weight: 700;
  font-size: 14px;
  padding-top: 2px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.indicator-row .desc {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.5;
  min-width: 0;
}

.badge {
  display: inline-block;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 6px;
  white-space: nowrap;
}
.badge.needs-action {
  background: var(--waiting-card);
  color: var(--waiting);
  border: 1px solid rgba(178,122,28,0.3);
}
.badge.pitch-tag { background: var(--pitch-bg); color: var(--green); }
.badge.decision-tag { background: var(--decision-bg); color: var(--gold); }

/* Knowledge base */
.kb-layout {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 36px;
  align-items: start;
}
.kb-sidebar { position: sticky; top: 76px; }
.kb-sidebar .kb-group { margin-bottom: 20px; }
.kb-sidebar .kb-group-label {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 6px;
}
.kb-sidebar a {
  display: block;
  padding: 8px 0;
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 600;
  min-height: 36px;
}
.kb-sidebar a.active,
.kb-sidebar a:hover { color: var(--green); }
.kb-content { min-width: 0; }
.kb-content h1 {
  font-size: clamp(24px, 6vw, 30px);
  margin: 0 0 6px;
  letter-spacing: -0.4px;
  line-height: 1.15;
  text-wrap: balance;
}
.kb-content p.dek {
  color: var(--text-muted);
  font-size: 15px;
  margin: 0 0 28px;
  line-height: 1.5;
}
.kb-content h2 {
  font-size: 18px;
  margin: 28px 0 10px;
}
.kb-content p {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.6;
}
.kb-content ul {
  color: var(--text-secondary);
  font-size: 15px;
  padding-left: 1.15em;
  margin: 0 0 12px;
}
.kb-content li { margin-bottom: 8px; line-height: 1.5; }
.callout {
  background: var(--surface-inset);
  border-left: 3px solid var(--green);
  border-radius: 8px;
  padding: 14px 16px;
  font-size: 14px;
  color: var(--text-secondary);
  margin: 18px 0;
  line-height: 1.5;
}
.kb-crumbs {
  font-size: 13px;
  color: var(--text-faint);
  margin-bottom: 14px;
}
.kb-crumbs a { color: var(--text-faint); font-weight: 500; }

/* Footer */
footer.site {
  border-top: 1px solid var(--border);
  padding: 28px 0 calc(28px + env(safe-area-inset-bottom));
  color: var(--text-faint);
  font-size: 13px;
}
footer.site .wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
footer.site a { color: var(--text-muted); }

/* ---------- Mobile ---------- */
@media (max-width: 780px) {
  :root { --pad: 16px; }

  header.site .wrap {
    padding-top: 10px;
    padding-bottom: 10px;
    flex-wrap: wrap;
  }

  .nav-toggle-label { display: inline-flex; }

  nav.site-nav {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 6px 0 4px;
    border-top: 1px solid var(--border);
    margin-top: 4px;
  }
  .nav-toggle:checked ~ nav.site-nav { display: flex; }

  nav.site-nav a {
    padding: 12px 4px;
    font-size: 15px;
    border-radius: 8px;
  }
  nav.site-nav a.cta {
    text-align: center;
    margin-top: 6px;
    padding: 12px 14px;
  }

  .hero {
    padding: 32px 0 28px;
  }
  .hero .eyebrow {
    letter-spacing: 1.2px;
    margin-bottom: 10px;
  }
  .hero p.lede {
    font-size: 15.5px;
    margin-bottom: 20px;
  }
  .hero .actions,
  .actions {
    flex-direction: column;
    align-items: stretch;
  }
  .hero .actions .btn,
  .actions .btn {
    width: 100%;
  }

  section { padding: 36px 0; }
  p.section-sub { margin-bottom: 20px; }

  .grid-3,
  .grid-2 {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .card { padding: 16px; }

  .kb-layout {
    grid-template-columns: 1fr;
    gap: 18px;
  }
  .kb-sidebar {
    position: static;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    padding-bottom: 6px;
    margin: 0 calc(-1 * var(--pad));
    padding-left: var(--pad);
    padding-right: var(--pad);
    scrollbar-width: none;
  }
  .kb-sidebar::-webkit-scrollbar { display: none; }
  /* Flatten groups so every link is one continuous chip row */
  .kb-sidebar .kb-group {
    margin: 0;
    display: contents;
  }
  .kb-sidebar .kb-group-label {
    display: none;
  }
  .kb-sidebar a {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
    font-size: 13px;
    white-space: nowrap;
    min-height: 36px;
    flex: 0 0 auto;
  }
  .kb-sidebar a.active {
    background: var(--green);
    color: var(--green-text);
    border-color: var(--green);
  }

  .indicator-row {
    flex-direction: column;
    gap: 6px;
    padding: 12px 0;
  }
  .indicator-row .label {
    min-width: 0;
    width: 100%;
  }

  footer.site .wrap {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 380px) {
  .brand { font-size: 15px; gap: 8px; }
  .brand .mark { width: 26px; height: 26px; font-size: 12px; }
  .hero h1 { font-size: 26px; }
}
