:root {
  --bg: #f4efe6;
  --ink: #1f1a17;
  --muted: #6f675f;
  --card: #fffdf9;
  --line: #e4dcd0;
  --orange: #d86a2f;
  --orange-dark: #b8531f;
  --green: #e5f2e6;
  --green-ink: #24633a;
  --amber: #f8ecd6;
  --amber-ink: #8a5a12;
  --gray: #eeeae4;
}

* { box-sizing: border-box; }

body {
  display: flex;
  flex-direction: column;
  height: 100vh;
  margin: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.4 ui-sans-serif, system-ui, sans-serif;
}

body.landing-body {
  height: auto;
  min-height: 100vh;
  overflow: auto;
}

body.review-body {
  height: auto;
  min-height: 100vh;
  overflow: auto;
}

.review-bar {
  width: min(720px, calc(100% - 32px));
  margin: 0 auto;
}

.review-page {
  width: min(720px, calc(100% - 32px));
  margin: 24px auto 48px;
}

.review-page h1 {
  margin: 0 0 8px;
  font-size: 1.6rem;
}

.review-page h2 {
  margin: 20px 0 8px;
  font-size: 1rem;
}

.review-heading,
.review-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.review-heading {
  margin-bottom: 20px;
}

.review-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.review-edit {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.review-card {
  margin-top: 14px;
  padding: 20px;
}

.review-card h2,
.review-card h3 {
  margin-top: 0;
}

.review-card h3 {
  margin-bottom: 6px;
  font-size: 13px;
}

.review-card li + li {
  margin-top: 6px;
}

.review-facts {
  display: grid;
  gap: 12px;
  margin: 0;
}

.review-facts div {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 12px;
}

.review-facts dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.review-facts dd {
  margin: 0;
}

.review-code {
  overflow: auto;
  margin: 18px 0 0;
  padding: 16px;
  border-radius: 10px;
  background: var(--gray);
  font: 13px/1.55 ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  white-space: pre;
}

.landing-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  align-self: stretch;
  width: 100%;
  max-width: 860px;
  margin: 0 auto;
  padding: 22px 28px;
}

.landing-bar nav {
  display: flex;
  gap: 18px;
}

.landing-bar a {
  color: var(--ink);
  text-decoration: none;
}

.landing {
  max-width: 860px;
  margin: 0 auto;
  padding: 36px 28px 120px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
  gap: 40px;
  align-items: center;
}

.hero h1 {
  margin: 0 0 8px;
  font-size: 36px;
  font-weight: 560;
  letter-spacing: -0.03em;
  line-height: 1.05;
}

.headline-next {
  margin: 0 0 16px;
  font-size: 22px;
  line-height: 1.35;
}

.hero .lede {
  margin: 0 0 28px;
  max-width: 36rem;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.55;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.button {
  display: inline-block;
  padding: 12px 18px;
  border-radius: 999px;
  font-size: 14px;
  text-decoration: none;
}

.button.primary {
  background: linear-gradient(180deg, var(--orange), var(--orange-dark));
  color: white;
}

.button.secondary {
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
}

.mockup {
  display: grid;
  grid-template-columns: 132px 1fr;
  min-height: 320px;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 18px 40px rgba(31, 26, 23, 0.06);
}

.mock-projects, .mock-main { padding: 16px; }

.mock-projects {
  background: #f7f1e8;
  border-right: 1px solid var(--line);
}

.mockup p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.mock-projects span, .mock-main li {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
}

.mock-projects .active {
  padding: 6px 8px;
  margin-left: -8px;
  background: white;
  border-radius: 8px;
}

.mock-main ol {
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
}

.mock-main li strong {
  display: inline-block;
  width: 72px;
  color: var(--muted);
  font-weight: 500;
}

.mock-report {
  padding: 12px;
  background: var(--green);
  border-radius: 12px;
}

.mock-report strong { display: block; margin-bottom: 6px; }

.mock-report span {
  color: var(--green-ink);
  font-size: 13px;
  line-height: 1.45;
}

.why-built {
  margin: 96px 0 28px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: center;
  color: var(--muted);
}

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

.pillars article {
  padding: 22px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.pillars h2 {
  margin: 0 0 8px;
  font-size: 18px;
  line-height: 1.3;
}

.pillars p, .objective {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.objective {
  margin-top: 24px;
  font-size: 18px;
  color: var(--ink);
  text-align: center;
}

@media (max-width: 800px) {
  .hero, .pillars { grid-template-columns: 1fr; }
  .hero h1 { font-size: 28px; }
  .mockup { grid-template-columns: 1fr; }
  .mock-projects { border-right: 0; border-bottom: 1px solid var(--line); }
}

button, input, textarea {
  font: inherit;
}

h1, h2, h3 {
  font-weight: 500;
  line-height: 1.25;
}

.topbar {
  display: flex;
  flex: none;
  align-items: center;
  gap: 16px;
  padding: 8px 16px;
  background: #fbf7f1;
  border-bottom: 1px solid var(--line);
}

.brand, .learner {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand strong, .learner strong { display: block; font-size: 13px; font-weight: 500; }
.brand small, .learner small { color: var(--muted); font-size: 11px; letter-spacing: 0.03em; text-transform: uppercase; }
.learner .user-id { text-transform: none; letter-spacing: 0; }

.account-menu {
  position: relative;
}

.account-menu summary {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  list-style: none;
}

.account-menu summary::-webkit-details-marker { display: none; }

.account-menu summary strong { font-size: 13px; font-weight: 500; }

.account-panel {
  position: absolute;
  right: 0;
  z-index: 20;
  min-width: 280px;
  margin-top: 8px;
  padding: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.account-panel p {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0 0 10px;
  font-size: 13px;
}

.account-panel span {
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.account-panel code {
  font-size: 12px;
  user-select: all;
}

.account-panel a {
  display: inline-block;
  color: var(--ink);
  font-size: 13px;
}

.mark, .avatar, .profile-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #24211e;
  color: white;
  font-size: 11px;
  text-decoration: none;
}

.profile-icon {
  margin-left: 8px;
  background: var(--orange);
}

.profile-form {
  display: grid;
  gap: 8px;
  max-width: 420px;
  margin-top: 16px;
}

.profile-form label {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.profile-details {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 8px 16px;
  margin: 16px 0;
}

.profile-details dt { color: var(--muted); }

.flash { color: var(--orange-dark); }

.workspace-label {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
}

.dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: #3c9a5d;
}

.eval-layout {
  grid-template-columns: minmax(280px, 1fr) minmax(420px, 1.2fr);
}

.eval-row {
  padding: 8px 10px;
  border-radius: 10px;
  background: white;
}

.eval-row p { margin: 6px 0 0; font-size: 13px; }

.layout {
  display: grid;
  flex: 1;
  grid-template-columns: 260px minmax(280px, 0.85fr) minmax(420px, 1.35fr);
  gap: 12px;
  min-height: 0;
  padding: 12px;
}

.panel {
  min-height: 0;
}

.panel.projects,
.panel.brief {
  overflow: auto;
}

.panel.report {
  display: flex;
  flex-direction: column;
}

.panel h1 { margin: 0 0 4px; font-size: 1.2rem; }
.panel h2 { margin: 0 0 4px; font-size: 0.95rem; }
.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.lede, .empty-workspace p, .files p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

.new-project, .search { display: flex; gap: 8px; margin: 8px 0 12px; }
.new-project { flex-wrap: wrap; }
.new-project input, .new-project select { flex: 1 1 0; min-width: 0; }
.new-project button { flex: 1 0 100%; }

input, textarea, select {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
}

button {
  width: auto;
  border: 0;
  border-radius: 999px;
  padding: 6px 12px;
  background: var(--orange);
  color: white;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}

button:hover { background: var(--orange-dark); }
button.saved { background: var(--green-ink); box-shadow: 0 0 0 3px #b7dfc4; }
button:disabled { opacity: 0.6; cursor: default; }

.progress { margin: 8px 0; }
.progress p { margin: 6px 0 0; color: var(--muted); }
.progress-bar {
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--orange) 0%, #f3c7a8 50%, var(--orange) 100%);
  background-size: 200% 100%;
  animation: progress-slide 1s linear infinite;
}
@keyframes progress-slide {
  from { background-position: 100% 0; }
  to { background-position: -100% 0; }
}

.project-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.project-list a {
  display: grid;
  gap: 1px;
  padding: 8px 10px;
  border-radius: 10px;
  color: inherit;
  text-decoration: none;
  background: transparent;
}
.project-list a.active, .project-list a:hover { background: #efe7da; }
.project-list small { color: var(--muted); font-size: 12px; }
.profile-label {
  display: inline-block;
  margin: 0 0 6px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--gray);
  color: var(--ink);
  font-size: 11px;
  font-style: normal;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.project-meta {
  display: flex;
  align-items: center;
  gap: 6px;
}
.delete-project {
  margin: 0;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--gray);
  color: var(--ink);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.4;
}

.status {
  width: fit-content;
  margin-top: 2px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-style: normal;
  font-weight: 500;
  background: var(--gray);
}
.status.reported, .status.completed { background: var(--green); color: var(--green-ink); }
.status.ready, .status.needs_review { background: var(--amber); color: var(--amber-ink); }
.status.error { background: #f8e4dc; color: #8d3418; }

.card {
  margin-top: 10px;
  padding: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.card header { margin-bottom: 6px; }
.card h3 { margin: 0; font-size: 0.95rem; }
.card header span { color: var(--muted); font-size: 13px; }

.inline-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px;
}

.inline-form label {
  flex: 1 0 100%;
  font-size: 13px;
  font-weight: 500;
}

.inline-form textarea,
.inline-form input {
  flex: 1 1 180px;
  width: auto;
  min-width: 0;
}

.report-card {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  margin-top: 0;
  overflow: hidden;
}

.report-controls {
  flex: none;
  background: var(--card);
}

.report-controls header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.report-controls header form { margin: 0; }

.files { margin-top: 8px; }
.files ul {
  flex: 1 0 100%;
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
}

.output {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding-top: 8px;
}

.output h4 {
  margin: 12px 0 4px;
  font-size: 12px;
  font-weight: 500;
}

.output p, .output li { font-size: 14px; }

.history {
  margin: 10px 0 0;
  padding: 10px 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.history h4 {
  margin: 8px 0 0;
  font-size: 13px;
  font-weight: 500;
}

.history summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
}

.history ul {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.history li {
  display: grid;
  gap: 2px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.recent {
  margin: 4px 0 8px;
}

.recent summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.project-history {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  display: grid;
  gap: 4px;
}

.recent-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
  padding: 4px 6px;
  border-radius: 8px;
  font-size: 12px;
}

.history-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.recent-row .review-link {
  white-space: nowrap;
  text-decoration: none;
}

.recent-row strong,
.history-time {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.history-time {
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.recent-row.is-selected {
  background: #fff8f3;
  outline: 1px solid var(--orange);
}

.topic-badge {
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--gray);
  color: var(--muted);
  font-size: 11px;
}

.recent-row.active {
  background: #fff8f3;
  outline: 1px solid var(--orange);
}

.recent-row .icon-button,
.recent-row input {
  padding: 2px 6px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
}

.history-card-header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: baseline;
}

.history-block {
  display: grid;
  gap: 2px;
  padding: 6px 8px;
  background: white;
  border-radius: 8px;
}

.history-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.history-block p { white-space: pre-wrap; }

.history-result {
  padding: 6px 8px;
  background: white;
  border-radius: 8px;
}

.history-result summary { cursor: pointer; font-size: 13px; font-weight: 500; }
.history-result p, .history-result ul { margin: 6px 0 0; }

.nav-link {
  color: var(--ink);
  font-size: 13px;
  text-decoration: none;
}

.pre { white-space: pre-wrap; }

.compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.compare-col {
  padding: 10px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.thread {
  display: grid;
  gap: 10px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
}

.thread li {
  padding: 8px 10px;
  background: white;
  border-radius: 8px;
}

.muted { color: var(--muted); }

.empty-workspace { padding: 24px 8px; }

@media (max-height: 760px) {
  .brand small { display: none; }
}

@media (max-width: 980px) {
  body { height: auto; min-height: 100vh; overflow: auto; }
  .brand small { display: none; }
  .layout {
    grid-template-columns: 1fr;
    overflow: visible;
  }
  .panel.projects,
  .panel.brief { overflow: visible; }
  .panel.report { min-height: 60vh; }
  .workspace-label { display: none; }
  .report-card { min-height: 60vh; }
}
