:root {
  --bg: #f4f1ea;
  --ink: #1c1914;
  --muted: #5c574e;
  --paper: #fffdf8;
  --line: #ddd6c8;
  --accent: #8c2f1b;
  --accent-2: #1f4d3a;
  --shadow: 0 12px 40px rgba(28, 25, 20, 0.08);
  --sans: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --ui: "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: radial-gradient(1200px 600px at 10% -10%, #efe7d6, var(--bg));
  color: var(--ink);
  font-family: var(--ui);
  line-height: 1.5;
  min-height: 100vh;
}

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

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1rem 2rem;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.86);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand {
  font-family: var(--sans);
  font-size: 1.15rem;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.brand small { display: block; color: var(--muted); font-size: 0.72rem; font-family: var(--ui); letter-spacing: 0.08em; text-transform: uppercase; }
nav { display: flex; gap: 1.1rem; flex-wrap: wrap; }
nav a { color: var(--muted); font-size: 0.92rem; }
nav a.active, nav a:hover { color: var(--ink); text-decoration: none; }
.who { color: var(--muted); font-size: 0.9rem; display: flex; gap: 0.8rem; align-items: center; }
button, .btn {
  background: var(--ink);
  color: var(--paper);
  border: 0;
  border-radius: 999px;
  padding: 0.55rem 1rem;
  cursor: pointer;
  font: inherit;
  display: inline-block;
}
.btn.secondary { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.ghost { background: transparent; color: var(--accent); padding: 0; }
main { max-width: 1080px; margin: 0 auto; padding: 2rem 1.25rem 4rem; }
.grid { display: grid; grid-template-columns: 2fr 1fr; gap: 1.25rem; }
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.25rem 1.4rem;
  box-shadow: var(--shadow);
}
h1, h2, h3 { font-family: var(--sans); letter-spacing: -0.03em; margin: 0 0 0.6rem; }
p.lede { color: var(--muted); margin-top: 0; }
label { display: block; font-size: 0.82rem; color: var(--muted); margin: 0.9rem 0 0.3rem; }
textarea, input[type=text], input[type=password], input[type=email] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.7rem 0.8rem;
  font: inherit;
  background: #fff;
}
.meta { color: var(--muted); font-size: 0.86rem; }
.chip { display: inline-block; border: 1px solid var(--line); border-radius: 999px; padding: 0.15rem 0.6rem; font-size: 0.78rem; color: var(--muted); }
.person { padding: 0.55rem 0; border-bottom: 1px solid var(--line); }
.person:last-child { border-bottom: 0; }
.org-node { margin: 0.35rem 0 0.35rem 1rem; padding-left: 0.8rem; border-left: 2px solid var(--line); }
.org-root { margin-left: 0; border-left: 0; padding-left: 0; }
.flash { padding: 0.8rem 1rem; border-radius: 12px; background: #efe7d6; margin-bottom: 1rem; }
.report-section { margin: 1.4rem 0; }
.report-section h2 { font-size: 1.2rem; color: var(--accent-2); }
pre, .prose { white-space: pre-wrap; font-family: var(--ui); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.65rem 0.4rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.login-wrap { max-width: 420px; margin: 8vh auto; }
.help { color: var(--muted); font-size: 0.85rem; }

/* Report generation */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.page-head form { margin: 0; }
section.card + section.card, #steps .card { margin-top: 1.25rem; }
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.7rem 0.8rem;
  font: inherit;
  background: #fff;
}
.status { display: inline-block; border-radius: 999px; padding: 0.15rem 0.65rem; font-size: 0.78rem; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.status-running { color: #7a5a00; border-color: #e5cf8a; background: #fbf3d9; }
.status-succeeded, .status-completed { color: var(--accent-2); border-color: #a9c9b8; background: #e8f2ec; }
.status-failed { color: var(--accent); border-color: #e2b3a6; background: #f8e8e3; }
.progress-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.6rem; }
.progress { height: 10px; border-radius: 999px; background: #ece6da; overflow: hidden; }
.progress-bar { height: 100%; background: var(--accent-2); transition: width 0.4s ease; }
.run-error { color: var(--accent); margin: 0.6rem 0 0; white-space: pre-wrap; }
.step-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.step-head h2 { font-size: 1.1rem; margin: 0; }
.step-active { border-color: #e5cf8a; }
.step h3 { font-size: 0.95rem; margin: 0.9rem 0 0.4rem; }
.step details { margin-top: 0.6rem; }
.step summary { cursor: pointer; color: var(--muted); font-size: 0.9rem; }
pre.stream {
  max-height: 360px;
  overflow: auto;
  background: #faf7f0;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.7rem 0.8rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8rem;
  margin: 0.4rem 0 0;
}
.reasoning-text { color: var(--muted); }
@media (max-width: 860px) {
  .grid { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; align-items: flex-start; }
}
