:root {
  --bg: #f5f5f0;
  --surface: rgba(255, 255, 252, 0.9);
  --surface-strong: #fffefb;
  --text: #17231f;
  --muted: #69766f;
  --line: #e5e5da;
  --accent: #155e52;
  --accent-soft: #e0eee9;
  --warm: #c96836;
  --warm-soft: #f7e9dd;
  --shadow: 0 18px 46px rgba(30, 42, 36, 0.07);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 5% 0%, #e4efe8 0, transparent 34%),
    radial-gradient(circle at 95% 8%, #f5e9dd 0, transparent 30%),
    var(--bg);
  min-height: 100vh;
}

.topbar {
  height: 72px;
  padding: 0 28px;
  display: flex;
  align-items: center;
  gap: 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(250, 250, 245, 0.72);
  backdrop-filter: blur(16px);
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand strong { display: block; font-size: 19px; letter-spacing: -0.03em; }
.brand small { color: var(--muted); font-size: 11px; letter-spacing: 0.12em; }

.mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  color: #fff;
  background: var(--accent);
  font-weight: 700;
  letter-spacing: -0.05em;
}

.status {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  color: var(--muted);
}

.pulse {
  width: 8px;
  height: 8px;
  background: #26a56d;
  border-radius: 50%;
  box-shadow: 0 0 0 5px rgba(38, 165, 109, .12);
}

.workspace {
  display: grid;
  grid-template-columns: 252px minmax(410px, 1fr) 400px;
  gap: 16px;
  padding: 18px;
  min-height: calc(100vh - 72px);
}

.panel {
  background: var(--surface);
  border: 1px solid rgba(225, 225, 215, .86);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.projects { padding: 20px 14px; }
.panel-title { display: flex; justify-content: space-between; align-items: center; margin: 0 6px 14px; }
.panel-title h2, .delivery h2 { font-size: 16px; margin: 0; letter-spacing: -0.03em; }
.hint { color: var(--muted); font-size: 13px; line-height: 1.55; margin: 0 6px 18px; }
.icon-button {
  border: 0; background: var(--accent-soft); color: var(--accent); font-size: 24px;
  border-radius: 11px; width: 35px; height: 35px; cursor: pointer;
}
.project-list { display: flex; flex-direction: column; gap: 8px; }
.project-item {
  padding: 13px 12px; border-radius: 13px; border: 1px solid transparent;
  cursor: pointer; background: transparent; text-align: left; width: 100%;
}
.project-item.active { background: var(--accent-soft); border-color: #cce0d8; }
.project-item strong { display: block; font-size: 14px; margin-bottom: 5px; }
.project-item span { display: block; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.conversation { padding: 25px; display: flex; flex-direction: column; min-height: calc(100vh - 108px); }
.hero { padding: 8px 7px 22px; border-bottom: 1px solid var(--line); }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .14em; color: var(--warm); margin: 0 0 10px; }
.hero h1 { font-size: clamp(27px, 3vw, 38px); line-height: 1.12; letter-spacing: -.055em; margin: 0 0 10px; }
.goal { margin: 0; color: var(--muted); max-width: 650px; line-height: 1.65; }
.messages { flex: 1; min-height: 250px; max-height: calc(100vh - 395px); overflow: auto; padding: 22px 5px; display: flex; flex-direction: column; gap: 14px; }
.message { max-width: 86%; padding: 13px 15px; border-radius: 15px; line-height: 1.62; white-space: pre-wrap; font-size: 14px; }
.message.assistant { background: #f1f2eb; align-self: flex-start; }
.message.user { background: var(--accent); color: white; align-self: flex-end; }
.message small { display: block; opacity: .62; font-size: 11px; margin-top: 7px; }
.composer { border: 1px solid var(--line); background: var(--surface-strong); border-radius: 16px; padding: 14px; }
.composer label { display: block; color: var(--muted); font-size: 12px; margin-bottom: 8px; }
textarea, input {
  width: 100%; border: 0; outline: 0; resize: vertical; font: inherit;
  background: transparent; color: var(--text);
}
.composer textarea { min-height: 62px; }
.composer-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; }
.muted { color: var(--muted); font-size: 12px; }

button, .link, .secondary {
  font: inherit; cursor: pointer; border-radius: 11px; padding: 10px 15px; border: 0;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center;
}
.primary { background: var(--accent); color: white; }
.primary:hover { background: #114c43; }
.primary:disabled { opacity: .55; cursor: wait; }
.secondary { background: var(--accent-soft); color: var(--accent); }
.compact { padding: 9px 14px; }

.inspector { display: flex; flex-direction: column; gap: 12px; }
.delivery { padding: 18px; }
.delivery-row { display: flex; justify-content: space-between; align-items: flex-start; }
.delivery-row .muted { margin: 7px 0 0; }
.delivery-actions { display: flex; gap: 9px; margin-top: 15px; }
.delivery-actions > * { flex: 1; font-size: 13px; }
.badge {
  padding: 5px 9px; border-radius: 999px; font-size: 11px; font-weight: 700;
  color: var(--accent); background: var(--accent-soft);
}
.badge.ready { color: var(--warm); background: var(--warm-soft); }

.stages-panel { padding: 17px 12px 12px; }
.stages { max-height: 270px; overflow: auto; }
.stage { display: grid; grid-template-columns: 45px 1fr 12px; gap: 8px; padding: 8px 8px; align-items: center; }
.stage-code { font-size: 12px; font-weight: 700; color: var(--muted); }
.stage strong { display: block; font-size: 13px; font-weight: 550; }
.stage-dot { height: 9px; width: 9px; border-radius: 50%; background: #d7d9d0; }
.stage.done .stage-dot { background: #2e9c72; }
.stage.current { background: var(--accent-soft); border-radius: 11px; }
.stage.current .stage-dot { background: var(--warm); }

.decisions, .reports { padding: 17px 12px; }
.decision { border-top: 1px solid var(--line); padding: 12px 6px 4px; }
.decision:first-child { border-top: 0; padding-top: 0; }
.decision h3 { margin: 0 0 6px; font-size: 13px; }
.decision p { margin: 0 0 10px; color: var(--muted); line-height: 1.45; font-size: 12px; }
.decision-actions { display: flex; gap: 7px; }
.decision-actions button { font-size: 12px; padding: 7px 10px; }
.decision-state { font-size: 12px; font-weight: 600; color: var(--accent); }
.report-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 5px 12px; }
.report-tabs button { padding: 6px 9px; font-size: 12px; background: #eff0e9; color: var(--muted); }
.report-tabs button.active { color: var(--accent); background: var(--accent-soft); }
.report-content { margin: 0 5px; min-height: 72px; padding: 12px; border-radius: 11px; background: #f4f4ef; font: 12px/1.65 inherit; white-space: pre-wrap; color: #39443e; }

dialog {
  width: min(460px, calc(100% - 32px)); border: 0; border-radius: 20px;
  padding: 0; box-shadow: 0 25px 70px rgba(16, 24, 20, .22);
}
dialog::backdrop { background: rgba(17, 25, 22, .34); backdrop-filter: blur(3px); }
#project-form { padding: 25px; }
#project-form h2 { margin: 0 0 20px; }
#project-form label { display: block; color: var(--muted); font-size: 13px; margin-bottom: 16px; }
#project-form input, #project-form textarea {
  margin-top: 8px; border: 1px solid var(--line); border-radius: 11px;
  padding: 11px; background: #fff; color: var(--text);
}
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; }

@media (max-width: 1120px) {
  .workspace { grid-template-columns: 220px 1fr; }
  .inspector { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  .topbar { padding: 0 15px; }
  .status { display: none; }
  .workspace { display: flex; flex-direction: column; padding: 10px; }
  .conversation { min-height: 70vh; }
  .inspector { display: flex; }
}
