:root {
  --ink: #11171b;
  --ink-soft: #344047;
  --ink-faint: #6c7778;
  --paper: #f4f0e7;
  --paper-deep: #ebe5d9;
  --surface: #fbf8f1;
  --surface-2: #f0ebdf;
  --line: #d6cebe;
  --line-strong: #bdb3a0;
  --night: #101a1c;
  --night-2: #172529;
  --night-line: #2b3b3d;
  --cream: #f4e7ca;
  --amber: #d0873f;
  --amber-soft: #f0d6ad;
  --teal: #2d6a63;
  --teal-soft: #c8ded7;
  --red: #a84d41;
  --red-soft: #efd0ca;
  --blue: #446781;
  --blue-soft: #d6e2e8;
  --green: #487455;
  --green-soft: #d4e4d2;
  --shadow: 0 16px 40px rgba(31, 39, 39, 0.09);
  --shadow-small: 0 5px 16px rgba(31, 39, 39, 0.07);
  --serif: "Iowan Old Style", "Palatino Linotype", "Noto Serif SC", "Songti SC", serif;
  --sans: "Avenir Next", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: "SFMono-Regular", "Cascadia Code", "Noto Sans Mono", monospace;
  --radius: 10px;
  --radius-small: 6px;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--paper); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 0%, rgba(208, 135, 63, 0.09), transparent 28rem),
    linear-gradient(120deg, rgba(255,255,255,0.18), transparent 42%),
    var(--paper);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
code { font-family: var(--mono); font-size: 0.92em; }
.is-hidden { display: none !important; }
.eyebrow {
  color: var(--ink-faint);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

/* Login */
.login-view {
  display: grid;
  grid-template-columns: minmax(360px, 1.05fr) minmax(430px, 0.95fr);
  min-height: 100vh;
}

.login-art {
  position: relative;
  display: flex;
  overflow: hidden;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  color: var(--cream);
  background:
    radial-gradient(circle at 50% 50%, rgba(208, 135, 63, 0.18), transparent 24rem),
    var(--night);
}

.login-art-grid {
  position: absolute;
  inset: 0;
  opacity: 0.24;
  background-image:
    linear-gradient(rgba(244, 231, 202, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(244, 231, 202, 0.12) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: radial-gradient(circle at 50% 45%, #000 10%, transparent 68%);
}

.login-mark {
  position: relative;
  z-index: 2;
  font-family: var(--serif);
  font-size: clamp(84px, 12vw, 170px);
  font-weight: 500;
  letter-spacing: -0.08em;
  line-height: 0.85;
  text-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

.login-art > p {
  position: relative;
  z-index: 2;
  margin-top: 26px;
  color: var(--amber-soft);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.orbit {
  position: absolute;
  z-index: 1;
  width: min(58vw, 620px);
  aspect-ratio: 1;
  border: 1px solid rgba(244, 231, 202, 0.17);
  border-radius: 50%;
  animation: orbit 38s linear infinite;
}

.orbit::after {
  content: "";
  position: absolute;
  top: 50%;
  left: -5px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 22px var(--amber);
}

.orbit span {
  position: absolute;
  top: 50%;
  right: -37px;
  padding: 3px 7px;
  color: var(--cream);
  background: var(--night);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.orbit-a { width: min(39vw, 430px); animation-duration: 22s; }
.orbit-b { width: min(51vw, 540px); animation-direction: reverse; animation-duration: 31s; }
.orbit-c { width: min(64vw, 680px); animation-duration: 46s; }

.login-route {
  position: absolute;
  bottom: 12%;
  width: 54%;
  height: 34px;
  border-top: 1px dashed rgba(244, 231, 202, 0.28);
  border-right: 1px dashed rgba(244, 231, 202, 0.28);
  border-radius: 0 18px 0 0;
  transform: skewX(-20deg);
}

.login-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(42px, 8vw, 120px);
  background:
    linear-gradient(90deg, rgba(17, 23, 27, 0.045) 1px, transparent 1px) 0 0 / 38px 38px,
    var(--surface);
}

.login-panel h1 {
  max-width: 620px;
  margin: 20px 0 18px;
  font-family: var(--serif);
  font-size: clamp(36px, 3.7vw, 56px);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 1.08;
  text-wrap: balance;
}

.lede {
  max-width: 560px;
  margin: 0;
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1.75;
}

.login-form { max-width: 650px; margin-top: 44px; }
.login-form label {
  display: block;
  margin-bottom: 8px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.field-row { display: flex; gap: 10px; }

.field-row input {
  flex: 1;
  min-width: 0;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-small);
  outline: none;
  background: #fffdf8;
  transition: border-color 0.18s, box-shadow 0.18s;
}

.field-row input:focus, .form-field input:focus, .form-field select:focus,
.form-field textarea:focus, .chat-composer textarea:focus {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(208, 135, 63, 0.16);
}

.form-hint { margin: 12px 0 0; color: var(--ink-faint); font-size: 12px; }
.login-foot {
  display: flex;
  gap: 20px;
  margin-top: 64px;
  color: var(--ink-faint);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Top navigation */
.app-view { min-height: 100vh; }
.topbar {
  position: sticky;
  z-index: 30;
  top: 0;
  display: flex;
  align-items: center;
  gap: 26px;
  height: 64px;
  padding: 0 24px;
  color: var(--cream);
  border-bottom: 1px solid var(--night-line);
  background: rgba(16, 26, 28, 0.97);
  backdrop-filter: blur(14px);
}

.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand-mark {
  color: var(--night);
  padding: 3px 7px 2px;
  border-radius: 3px;
  background: var(--amber-soft);
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.06em;
}
.brand-copy { display: flex; flex-direction: column; line-height: 1.1; }
.brand-copy strong { font-family: var(--serif); font-size: 15px; font-weight: 500; }
.brand-copy small { margin-top: 4px; color: #90a09d; font-family: var(--mono); font-size: 8px; letter-spacing: 0.15em; text-transform: uppercase; }

.project-picker { display: flex; align-items: center; gap: 9px; margin-left: 18px; }
.project-picker > span { color: #8fa19d; font-family: var(--mono); font-size: 9px; letter-spacing: 0.12em; text-transform: uppercase; }
.project-picker select {
  width: min(310px, 28vw);
  height: 34px;
  padding: 0 32px 0 10px;
  color: var(--cream);
  border: 1px solid var(--night-line);
  border-radius: 4px;
  outline: none;
  background: var(--night-2);
}

.connection { display: flex; align-items: center; gap: 7px; margin-left: auto; color: #9bb0ab; font-size: 11px; }
.connection-dot { width: 7px; height: 7px; border-radius: 50%; background: #72817e; }
.connection.is-live .connection-dot { background: #79b592; box-shadow: 0 0 10px rgba(121, 181, 146, 0.7); }
.connection.is-error .connection-dot { background: #d17061; }
.top-actions { display: flex; gap: 5px; }
.icon-button, .button {
  border: 1px solid transparent;
  border-radius: 4px;
  transition: background 0.16s, border-color 0.16s, color 0.16s, transform 0.16s;
}
.icon-button:active, .button:active { transform: translateY(1px); }
.icon-button { width: 36px; height: 34px; background: transparent; color: var(--cream); font-size: 18px; }
.menu-button { display: none; }

.button {
  min-height: 34px;
  padding: 0 14px;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.01em;
}
.button-primary { color: #fffaf0; background: var(--teal); border-color: var(--teal); }
.button-primary:hover { background: #245a54; border-color: #245a54; }
.button-quiet { color: inherit; border-color: currentColor; background: transparent; opacity: 0.78; }
.button-quiet:hover { opacity: 1; background: rgba(127, 127, 127, 0.09); }
.topbar .button-quiet { color: var(--cream); border-color: var(--night-line); }
.button-danger { color: var(--red); border-color: rgba(168, 77, 65, 0.5); background: transparent; }
.button-small { min-height: 29px; padding: 0 10px; font-size: 11px; }
.mini-button, .text-button {
  padding: 0;
  color: var(--teal);
  border: 0;
  background: transparent;
  font-size: 11px;
  font-weight: 700;
}
.text-button { border-bottom: 1px solid rgba(45, 106, 99, 0.45); }

/* Shell */
.workspace {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr) 310px;
  align-items: start;
  min-height: calc(100vh - 64px);
}

.rail {
  position: sticky;
  top: 64px;
  overflow-y: auto;
  height: calc(100vh - 64px);
  padding: 26px 20px 20px;
  border-right: 1px solid var(--line);
  background: rgba(240, 235, 223, 0.72);
  backdrop-filter: blur(10px);
}

.rail-head h2 {
  margin: 8px 0 7px;
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.15;
}
.rail-goal { margin: 0 0 10px; color: var(--ink-faint); font-size: 12px; line-height: 1.6; }
.rail-section { margin-top: 26px; }
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.section-note { color: var(--ink-faint); font-size: 10px; font-weight: 500; letter-spacing: 0; text-transform: none; }

.leader-panel { padding: 13px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-small); }
.leader-card { display: flex; gap: 11px; align-items: center; }
.leader-card h3 { margin: 1px 0 2px; font-family: var(--serif); font-size: 19px; font-weight: 600; }
.leader-card p { margin: 0; color: var(--ink-faint); font-size: 10px; }
.leader-tasks { margin-top: 11px; padding-top: 10px; border-top: 1px solid var(--line); }
.leader-tasks strong { color: var(--ink-faint); font-family: var(--mono); font-size: 9px; letter-spacing: 0.08em; text-transform: uppercase; }
.leader-tasks ul { margin: 5px 0 0; padding: 0; list-style: none; }
.leader-tasks li { overflow: hidden; color: var(--ink-soft); font-size: 11px; line-height: 1.7; text-overflow: ellipsis; white-space: nowrap; }
.leader-run-card { margin-top: 12px; padding-top: 11px; border-top: 1px solid var(--line); }
.leader-run-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.leader-run-state { color: var(--ink-faint); font-family: var(--mono); font-size: 8px; letter-spacing: 0.04em; text-transform: uppercase; }
.leader-run-state.state-queued { color: #8a641f; }
.leader-run-state.state-running { color: var(--teal); }
.leader-run-state.state-completed { color: #42734d; }
.leader-run-state.state-failed { color: var(--danger); }
.leader-run-copy { margin: 6px 0 0; color: var(--ink-faint); font-size: 10px; line-height: 1.55; }
.leader-run-instruction { display: -webkit-box; overflow: hidden; margin: 7px 0 0; color: var(--ink-soft); font-size: 10px; line-height: 1.5; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.leader-run-actions { display: flex; gap: 6px; margin-top: 9px; }
.leader-run-actions .leader-run-button { flex: 1; margin-top: 0; justify-content: center; }
.leader-run-actions .button-quiet { flex: 0 0 auto; }

.agent-list { display: flex; flex-direction: column; gap: 7px; margin-top: 10px; }
.agent-card {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  width: 100%;
  padding: 9px;
  text-align: left;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
}
.agent-card:hover { border-color: var(--line); background: rgba(251, 248, 241, 0.72); }
.agent-card.leader { border-color: #dcc191; background: #fbf4e4; }
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: var(--cream);
  background: var(--ink-soft);
  font-family: var(--serif);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}
.avatar.large { width: 42px; height: 42px; font-size: 16px; }
.avatar.leader-avatar { color: var(--night); background: var(--amber-soft); }
.avatar.small { width: 24px; height: 24px; font-size: 10px; }
.agent-main { display: block; min-width: 0; }
.agent-name { display: flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 750; }
.agent-role { display: block; overflow: hidden; margin-top: 1px; color: var(--ink-faint); font-size: 9.5px; text-overflow: ellipsis; white-space: nowrap; }
.agent-task { display: block; overflow: hidden; margin-top: 3px; color: var(--teal); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 1px 6px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.badge-leader { color: #6e461b; background: #f2d9ac; }
.badge-checker { color: #275b57; background: var(--teal-soft); }
.badge-kind { color: var(--ink-soft); background: var(--paper-deep); }
.dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; }
.dot-online { background: #5d936c; }
.dot-working { background: var(--amber); box-shadow: 0 0 0 3px rgba(208, 135, 63, 0.15); }
.dot-offline { background: #a9a69e; }
.dot-check { background: var(--teal); }
.legend-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; margin-top: 12px; color: var(--ink-faint); font-size: 10px; }
.legend-grid span { display: flex; align-items: center; gap: 6px; }
.rail-foot { display: flex; justify-content: space-between; margin-top: 34px; padding-top: 14px; color: var(--ink-faint); border-top: 1px solid var(--line); font-family: var(--mono); font-size: 8px; letter-spacing: 0.06em; text-transform: uppercase; }

/* Main */
.main-panel { min-width: 0; padding: 0 28px 50px; }
.view-tabs {
  position: sticky;
  z-index: 15;
  top: 64px;
  display: flex;
  align-items: center;
  gap: 2px;
  min-height: 58px;
  border-bottom: 1px solid var(--line);
  background: rgba(244, 240, 231, 0.92);
  backdrop-filter: blur(12px);
}
.tab {
  position: relative;
  align-self: stretch;
  padding: 0 14px;
  color: var(--ink-faint);
  border: 0;
  background: transparent;
  font-size: 12px;
  font-weight: 700;
}
.tab::after { content: ""; position: absolute; right: 12px; bottom: -1px; left: 12px; height: 2px; background: transparent; }
.tab:hover { color: var(--ink); }
.tab.is-active { color: var(--ink); }
.tab.is-active::after { background: var(--amber); }
.tab-count { margin-left: 5px; padding: 1px 5px; color: var(--ink-faint); border-radius: 999px; background: var(--paper-deep); font-family: var(--mono); font-size: 8px; }
.tab-spacer { flex: 1; }
.view { display: none; padding-top: 30px; animation: view-in 0.25s ease both; }
.view.is-active { display: block; }

.project-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 250px;
  gap: 26px;
  align-items: stretch;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.6), transparent 50%),
    var(--surface);
  box-shadow: var(--shadow);
}
.hero-copy h1 {
  max-width: 760px;
  margin: 8px 0 10px;
  font-family: var(--serif);
  font-size: clamp(29px, 2.8vw, 44px);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 1.12;
  text-wrap: balance;
}
.hero-copy p { max-width: 700px; margin: 0; color: var(--ink-soft); font-size: 14px; line-height: 1.75; }
.hero-pills { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 18px; }
.hero-pill { padding: 4px 8px; color: var(--ink-soft); border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,0.42); font-size: 9.5px; }
.progress-card { display: flex; flex-direction: column; justify-content: center; padding: 17px; border-left: 1px solid var(--line); }
.progress-top { display: flex; align-items: baseline; justify-content: space-between; }
.progress-top span { color: var(--ink-faint); font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; }
.progress-top strong { font-family: var(--serif); font-size: 34px; font-weight: 500; letter-spacing: -0.05em; }
progress { width: 100%; height: 7px; overflow: hidden; border: 0; border-radius: 999px; background: var(--paper-deep); }
progress::-webkit-progress-bar { background: var(--paper-deep); border-radius: 999px; }
progress::-webkit-progress-value { background: linear-gradient(90deg, var(--teal), #71a68b); border-radius: 999px; }
progress::-moz-progress-bar { background: linear-gradient(90deg, var(--teal), #71a68b); border-radius: 999px; }
.progress-meta { display: flex; justify-content: space-between; margin-top: 9px; color: var(--ink-faint); font-size: 9px; }

.stats-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 13px; }
.stat-card { min-height: 90px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 8px; background: rgba(251, 248, 241, 0.64); }
.stat-card span { color: var(--ink-faint); font-family: var(--mono); font-size: 8px; letter-spacing: 0.1em; text-transform: uppercase; }
.stat-card strong { display: block; margin-top: 5px; font-family: var(--serif); font-size: 28px; font-weight: 500; line-height: 1; }
.stat-card small { display: block; margin-top: 7px; color: var(--ink-faint); font-size: 9px; }

.panel { margin-top: 22px; padding: 20px; border: 1px solid var(--line); border-radius: 9px; background: rgba(251, 248, 241, 0.6); }
.plan-panel { border-left: 3px solid var(--amber); }
.plan-objective { margin: 10px 0 0; font-family: var(--serif); font-size: 20px; line-height: 1.5; }
.assumption-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 11px; }
.assumption-list span { padding: 3px 7px; color: var(--ink-faint); border: 1px dashed var(--line-strong); border-radius: 4px; font-size: 9px; }
.plan-empty { margin: 9px 0 0; color: var(--ink-faint); font-size: 12px; }

.board-section { margin-top: 26px; }
.board-heading { margin-bottom: 10px; }
.board { display: grid; grid-template-columns: repeat(5, minmax(210px, 1fr)); gap: 9px; overflow-x: auto; padding-bottom: 8px; }
.lane { min-height: 240px; padding: 10px; border: 1px solid var(--line); border-radius: 9px; background: rgba(239, 234, 222, 0.55); }
.lane-head { display: flex; align-items: center; justify-content: space-between; padding: 0 2px 9px; }
.lane-head strong { display: flex; align-items: center; gap: 6px; font-size: 10px; letter-spacing: 0.07em; text-transform: uppercase; }
.lane-head span { color: var(--ink-faint); font-family: var(--mono); font-size: 9px; }
.lane-head i { display: inline-block; width: 7px; height: 7px; border-radius: 2px; background: var(--line-strong); }
.lane-bucket-prepare i { background: #9c8d75; }
.lane-bucket-build i { background: var(--amber); }
.lane-bucket-review i { background: var(--teal); }
.lane-bucket-blocked i { background: var(--red); }
.lane-bucket-done i { background: var(--green); }
.lane-cards { display: flex; flex-direction: column; gap: 8px; }
.lane-empty { padding: 17px 8px; color: #9a958b; border: 1px dashed var(--line); border-radius: 6px; font-size: 10px; text-align: center; }

.task-card {
  display: block;
  width: 100%;
  padding: 11px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  box-shadow: 0 2px 7px rgba(31, 39, 39, 0.035);
  transition: transform 0.16s, border-color 0.16s, box-shadow 0.16s;
}
.task-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-small); transform: translateY(-1px); }
.task-card-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.task-kind { color: var(--ink-faint); font-family: var(--mono); font-size: 8px; letter-spacing: 0.06em; text-transform: uppercase; }
.task-kind.collective { color: var(--teal); }
.state-pill { display: inline-flex; align-items: center; min-height: 19px; padding: 1px 6px; border-radius: 999px; font-family: var(--mono); font-size: 8px; font-weight: 700; letter-spacing: 0.04em; white-space: nowrap; }
.state-assigned, .state-draft { color: #6e6252; background: #e9e2d3; }
.state-confirmed { color: #635d3d; background: #eee4bc; }
.state-working { color: #7a491d; background: #f3d9b8; }
.state-submitted, .state-checking { color: #255751; background: var(--teal-soft); }
.state-changes_requested { color: #854323; background: #f4d8c5; }
.state-blocked, .state-escalated { color: #78362e; background: var(--red-soft); }
.state-done { color: #355b3f; background: var(--green-soft); }
.state-cancelled { color: #75716b; background: #e5e2db; }
.task-title { margin-top: 8px; font-family: var(--serif); font-size: 15.5px; font-weight: 600; line-height: 1.35; }
.task-objective { display: -webkit-box; overflow: hidden; margin-top: 5px; color: var(--ink-faint); font-size: 9.5px; line-height: 1.5; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.task-meta { display: flex; align-items: center; gap: 5px; margin-top: 10px; }
.task-meta .avatar { margin-right: -7px; border: 1px solid var(--surface); }
.task-check { margin-left: auto; color: var(--ink-faint); font-size: 8px; }
.task-progress { margin-top: 9px; }
.task-progress progress { height: 3px; }
.task-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; color: var(--ink-faint); font-size: 8px; }
.meeting-chip { color: var(--teal); }

/* Activity rail */
.activity-rail {
  position: sticky;
  top: 64px;
  overflow-y: auto;
  height: calc(100vh - 64px);
  padding: 27px 20px;
  border-left: 1px solid var(--line);
  background: rgba(239, 234, 222, 0.46);
}
.activity-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.activity-head h2 { margin: 5px 0 0; font-family: var(--serif); font-size: 23px; font-weight: 500; letter-spacing: -0.03em; }
.live-badge { display: flex; align-items: center; gap: 5px; padding: 3px 6px; color: #3b6c4d; border: 1px solid #b4cdb8; border-radius: 999px; background: #edf4ea; font-family: var(--mono); font-size: 8px; }
.live-badge i { width: 5px; height: 5px; border-radius: 50%; background: #5f9a6e; }
.activity-list { position: relative; display: flex; flex-direction: column; gap: 0; margin-top: 19px; }
.activity-list::before { content: ""; position: absolute; top: 6px; bottom: 6px; left: 8px; width: 1px; background: var(--line); }
.activity-item { position: relative; display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 9px; padding: 0 0 16px; }
.activity-node { position: relative; z-index: 1; width: 7px; height: 7px; margin: 5px auto 0; border: 2px solid var(--paper); border-radius: 50%; background: var(--line-strong); box-shadow: 0 0 0 1px var(--line); }
.activity-node.tone-agent { background: var(--amber); }
.activity-node.tone-task { background: var(--teal); }
.activity-node.tone-meeting { background: var(--blue); }
.activity-node.tone-audit { background: var(--red); }
.activity-copy { min-width: 0; }
.activity-copy strong { display: block; color: var(--ink-soft); font-size: 10px; font-weight: 700; }
.activity-copy p { margin: 2px 0 0; color: var(--ink-faint); font-size: 9.5px; line-height: 1.45; }
.activity-copy time { display: block; margin-top: 3px; color: #9d978b; font-family: var(--mono); font-size: 7.5px; }
.activity-foot { margin-top: 20px; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: rgba(251, 248, 241, 0.55); }
.activity-foot strong { font-size: 10px; }
.activity-foot p { margin: 5px 0 0; color: var(--ink-faint); font-size: 9.5px; line-height: 1.6; }

/* Meetings */
.meeting-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 16px; min-height: calc(100vh - 200px); }
.meeting-index { padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: rgba(251, 248, 241, 0.58); }
.meeting-list { display: flex; flex-direction: column; gap: 7px; margin-top: 12px; }
.meeting-item { display: block; width: 100%; padding: 10px; text-align: left; border: 1px solid transparent; border-radius: 6px; background: transparent; }
.meeting-item:hover { border-color: var(--line); background: var(--surface); }
.meeting-item.is-active { border-color: var(--line-strong); background: var(--surface); box-shadow: var(--shadow-small); }
.meeting-item-top { display: flex; align-items: center; justify-content: space-between; gap: 5px; }
.meeting-state { color: var(--ink-faint); font-family: var(--mono); font-size: 8px; text-transform: uppercase; }
.meeting-state.open { color: var(--teal); }
.meeting-state.closed { color: var(--green); }
.meeting-item strong { display: block; margin-top: 6px; font-family: var(--serif); font-size: 14px; line-height: 1.35; }
.meeting-item p { margin: 5px 0 0; color: var(--ink-faint); font-size: 9px; }

.meeting-room { display: flex; overflow: hidden; flex-direction: column; min-height: 640px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow-small); }
.meeting-room-head { padding: 18px 20px; border-bottom: 1px solid var(--line); background: linear-gradient(120deg, #faf6ed, #f1ebdd); }
.meeting-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.meeting-title-row h2 { margin: 3px 0 0; font-family: var(--serif); font-size: 27px; font-weight: 500; letter-spacing: -0.035em; }
.meeting-controls { display: flex; flex-wrap: wrap; gap: 5px; justify-content: flex-end; }
.meeting-agenda { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.meeting-agenda span { padding: 3px 7px; color: var(--ink-soft); border: 1px solid var(--line); border-radius: 4px; background: rgba(255,255,255,0.4); font-size: 9px; }
.meeting-participants { display: flex; align-items: center; gap: 4px; margin-top: 12px; }
.meeting-participants .avatar { border: 1px solid var(--surface); }
.meeting-participants small { margin-left: 6px; color: var(--ink-faint); font-size: 9px; }
.speaker-badge { display: inline-flex; align-items: center; gap: 5px; margin-left: auto; padding: 3px 7px; color: #744b1e; border-radius: 999px; background: #f4ddb7; font-size: 9px; }
.speaker-badge i { width: 5px; height: 5px; border-radius: 50%; background: var(--amber); }

.messages { display: flex; overflow-y: auto; flex: 1; flex-direction: column; gap: 13px; min-height: 300px; max-height: 50vh; padding: 20px; background-image: linear-gradient(rgba(17,23,27,0.025) 1px, transparent 1px); background-size: 100% 32px; }
.message { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 9px; max-width: 84%; }
.message.self { align-self: flex-end; grid-template-columns: minmax(0, 1fr) 30px; }
.message.self .message-body { grid-column: 1; grid-row: 1; }
.message.self .avatar { grid-column: 2; grid-row: 1; }
.message.system { align-self: center; display: block; max-width: 80%; color: var(--ink-faint); font-size: 9.5px; text-align: center; }
.message.system .avatar { display: none; }
.message.decision { max-width: 94%; align-self: center; grid-template-columns: 30px minmax(0, 1fr); }
.message-head { display: flex; align-items: baseline; gap: 7px; }
.message-head strong { font-size: 10px; }
.message-head time { color: var(--ink-faint); font-family: var(--mono); font-size: 8px; }
.message-bubble { margin-top: 3px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 3px 9px 9px 9px; background: #fffdf8; font-size: 12px; line-height: 1.65; white-space: pre-wrap; word-break: break-word; }
.message.self .message-bubble { color: #f8f2e8; border-color: var(--teal); border-radius: 9px 3px 9px 9px; background: var(--teal); }
.message.decision .message-bubble { border-color: #bdcfae; background: #eff4e9; }
.message.decision .message-head strong::after { content: " · 决议"; color: var(--green); font-family: var(--mono); font-size: 8px; }
.message.system .message-bubble { padding: 5px 10px; border: 0; border-radius: 999px; background: var(--paper-deep); }
.chat-composer { padding: 14px 16px; border-top: 1px solid var(--line); background: #f8f4eb; }
.chat-composer textarea { width: 100%; min-height: 58px; max-height: 170px; padding: 9px 11px; resize: vertical; border: 1px solid var(--line-strong); border-radius: 6px; outline: none; background: #fffdf8; font-size: 12px; line-height: 1.55; }
.chat-composer-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 7px; color: var(--ink-faint); font-size: 9px; }
.meeting-decision { margin: 16px 20px 0; padding: 13px 15px; border: 1px solid #bbcea9; border-left: 3px solid var(--green); border-radius: 5px; background: #f1f5ec; }
.meeting-decision strong { font-family: var(--mono); font-size: 9px; letter-spacing: 0.08em; text-transform: uppercase; }
.meeting-decision p { margin: 5px 0 0; font-size: 11px; line-height: 1.65; }
.action-list { margin: 8px 0 0; padding-left: 17px; color: var(--ink-soft); font-size: 10px; }
.action-list li { margin-top: 3px; }

/* Audit */
.audit-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 19px; }
.audit-head h2 { margin: 5px 0 3px; font-family: var(--serif); font-size: 36px; font-weight: 500; letter-spacing: -0.04em; }
.audit-head p { max-width: 620px; margin: 0; color: var(--ink-faint); font-size: 12px; }
.event-ledger { border: 1px solid var(--line); border-radius: 9px; background: rgba(251, 248, 241, 0.66); }
.event-row { display: grid; grid-template-columns: 74px 110px minmax(0, 1fr) 120px; gap: 14px; align-items: start; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.event-row:last-child { border-bottom: 0; }
.event-id { color: var(--ink-faint); font-family: var(--mono); font-size: 9px; }
.event-type { color: var(--teal); font-family: var(--mono); font-size: 8.5px; font-weight: 700; word-break: break-word; }
.event-summary strong { display: block; font-size: 11px; }
.event-summary p { margin: 3px 0 0; color: var(--ink-faint); font-size: 9.5px; line-height: 1.5; word-break: break-word; }
.event-time { color: var(--ink-faint); font-family: var(--mono); font-size: 8px; text-align: right; }

/* Drawer */
.drawer-backdrop { position: fixed; z-index: 80; inset: 0; background: rgba(16, 26, 28, 0.35); backdrop-filter: blur(2px); }
.task-drawer { position: fixed; z-index: 90; top: 0; right: 0; bottom: 0; overflow-y: auto; width: min(620px, 92vw); padding: 30px 34px 50px; border-left: 1px solid var(--line-strong); background: var(--surface); box-shadow: -24px 0 70px rgba(16, 26, 28, 0.18); animation: drawer-in 0.24s ease both; }
.drawer-close { position: absolute; top: 17px; right: 18px; width: 32px; height: 32px; color: var(--ink-soft); border: 1px solid var(--line); border-radius: 50%; background: transparent; font-size: 20px; line-height: 1; }
.drawer-topline { display: flex; align-items: center; gap: 7px; padding-right: 40px; }
.drawer-content h1 { margin: 12px 0 8px; padding-right: 30px; font-family: var(--serif); font-size: 34px; font-weight: 500; letter-spacing: -0.04em; line-height: 1.13; }
.drawer-objective { margin: 0; color: var(--ink-soft); font-size: 13px; line-height: 1.7; }
.drawer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 20px; }
.drawer-metric { padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; background: rgba(246,242,233,0.7); }
.drawer-metric span { display: block; color: var(--ink-faint); font-family: var(--mono); font-size: 8px; letter-spacing: 0.06em; text-transform: uppercase; }
.drawer-metric strong { display: block; margin-top: 3px; font-size: 12px; }
.brief-block { margin-top: 22px; }
.brief-block h3 { margin: 0 0 8px; color: var(--ink-soft); font-family: var(--mono); font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; }
.brief-list { display: flex; flex-direction: column; gap: 5px; margin: 0; padding: 0; list-style: none; }
.brief-list li { position: relative; padding-left: 13px; color: var(--ink-soft); font-size: 11.5px; line-height: 1.6; }
.brief-list li::before { content: ""; position: absolute; top: 0.65em; left: 2px; width: 4px; height: 4px; border-radius: 50%; background: var(--amber); }
.context-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.context-card { padding: 10px; border: 1px solid var(--line); border-radius: 6px; background: rgba(245,240,231,0.65); }
.context-card h4 { margin: 0 0 5px; color: var(--ink-faint); font-family: var(--mono); font-size: 8px; letter-spacing: 0.06em; text-transform: uppercase; }
.context-card p { margin: 0; color: var(--ink-soft); font-size: 10px; line-height: 1.55; white-space: pre-wrap; }
.run-card, .approval-card, .artifact-card { margin-top: 8px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 6px; background: rgba(255,253,248,0.75); }
.run-card-head, .approval-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.run-card-head strong, .approval-head strong { font-size: 11px; }
.run-card p, .approval-card p { margin: 6px 0 0; color: var(--ink-soft); font-size: 10px; line-height: 1.55; white-space: pre-wrap; }
.evidence-list { margin: 7px 0 0; padding: 0; list-style: none; }
.evidence-list li { padding: 5px 0; color: var(--ink-soft); border-top: 1px dashed var(--line); font-family: var(--mono); font-size: 9px; word-break: break-word; }
.artifact-card { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.artifact-card a { color: var(--teal); font-size: 10px; font-weight: 700; text-decoration: none; }
.artifact-card small { display: block; color: var(--ink-faint); font-size: 8px; }
.drawer-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 26px; padding-top: 16px; border-top: 1px solid var(--line); }

/* Modal */
.modal-root { position: fixed; z-index: 100; inset: 0; display: flex; align-items: center; justify-content: center; padding: 20px; background: rgba(16, 26, 28, 0.46); backdrop-filter: blur(4px); }
.modal { overflow-y: auto; width: min(720px, 96vw); max-height: 92vh; padding: 24px; border: 1px solid var(--line-strong); border-radius: 11px; background: var(--surface); box-shadow: 0 28px 90px rgba(16,26,28,0.28); animation: modal-in 0.2s ease both; }
.modal.wide { width: min(880px, 96vw); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; }
.modal-head h2 { margin: 3px 0 0; font-family: var(--serif); font-size: 29px; font-weight: 500; letter-spacing: -0.04em; }
.modal-close { width: 30px; height: 30px; color: var(--ink-faint); border: 1px solid var(--line); border-radius: 50%; background: transparent; font-size: 18px; }
.modal-intro { margin: 8px 0 0; color: var(--ink-faint); font-size: 11px; }
.modal-body { margin-top: 20px; }
.modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 7px; margin-top: 22px; padding-top: 15px; border-top: 1px solid var(--line); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.form-grid.three { grid-template-columns: repeat(3, 1fr); }
.form-field { display: flex; flex-direction: column; gap: 5px; }
.form-field.full { grid-column: 1 / -1; }
.form-field label { color: var(--ink-soft); font-size: 10px; font-weight: 700; }
.form-field label span { color: var(--ink-faint); font-weight: 400; }
.form-field input, .form-field select, .form-field textarea {
  width: 100%;
  min-height: 36px;
  padding: 7px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  outline: none;
  background: #fffdf8;
  font-size: 11.5px;
}
.form-field textarea { min-height: 68px; resize: vertical; line-height: 1.55; }
.form-field select[multiple] { min-height: 84px; }
.form-help { color: var(--ink-faint); font-size: 9px; line-height: 1.5; }
.form-section { margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--line); }
.form-section:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.form-section h3 { margin: 0 0 10px; font-family: var(--mono); font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; }
.form-section p { margin: 0 0 10px; color: var(--ink-faint); font-size: 10px; }
.meeting-fields.is-hidden { display: none; }
.token-panel { margin-top: 15px; padding: 14px; border: 1px solid #b5c8a4; border-radius: 7px; background: #f0f5eb; }
.token-panel h3 { margin: 0; font-family: var(--serif); font-size: 20px; }
.token-panel p { margin: 4px 0 10px; color: var(--ink-faint); font-size: 10px; }
.token-value { display: flex; gap: 7px; }
.token-value code { flex: 1; overflow-x: auto; padding: 8px 9px; border: 1px solid #b6c8a9; border-radius: 4px; background: #fff; font-size: 10px; white-space: nowrap; }
.token-value input { flex: 1; min-width: 0; padding: 8px 9px; border: 1px solid #b6c8a9; border-radius: 4px; background: #fff; font-family: var(--mono); font-size: 10px; }
.agent-detail-head { display: flex; align-items: center; gap: 13px; margin-bottom: 17px; padding-bottom: 15px; border-bottom: 1px solid var(--line); }
.agent-detail-head h3 { margin: 0; font-family: var(--serif); font-size: 24px; font-weight: 500; }
.agent-detail-head p { margin: 3px 0 0; color: var(--ink-faint); font-size: 10px; }
.json-template { min-height: 260px; font-family: var(--mono); font-size: 10px; }

/* Empty and toast */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 380px; padding: 40px; color: var(--ink-faint); border: 1px dashed var(--line-strong); border-radius: 11px; background: rgba(251,248,241,0.38); text-align: center; }
.empty-state.compact { min-height: 300px; border: 0; background: transparent; }
.empty-glyph { color: var(--amber); font-family: var(--serif); font-size: 64px; line-height: 1; }
.empty-state h3 { margin: 12px 0 5px; color: var(--ink-soft); font-family: var(--serif); font-size: 22px; font-weight: 500; }
.empty-state p { max-width: 440px; margin: 0; font-size: 11px; line-height: 1.65; }
.empty-actions { display: flex; gap: 7px; margin-top: 16px; }
.toast-root { position: fixed; z-index: 120; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; width: min(360px, calc(100vw - 40px)); }
.toast { padding: 11px 13px; color: var(--cream); border-left: 3px solid var(--amber); border-radius: 5px; background: var(--night); box-shadow: var(--shadow); font-size: 11px; animation: toast-in 0.2s ease both; }
.toast.error { border-left-color: #e08673; }
.toast.success { border-left-color: #85b98e; }
.mobile-backdrop { position: fixed; z-index: 35; inset: 64px 0 0; background: rgba(16,26,28,0.38); }

@keyframes orbit { to { transform: rotate(360deg); } }
@keyframes view-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
@keyframes drawer-in { from { transform: translateX(30px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes modal-in { from { transform: translateY(8px) scale(0.99); opacity: 0; } to { transform: translateY(0) scale(1); opacity: 1; } }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

@media (max-width: 1280px) {
  .workspace { grid-template-columns: 250px minmax(0, 1fr); }
  .activity-rail { display: none; }
  .main-panel { padding-right: 22px; padding-left: 22px; }
}

@media (max-width: 900px) {
  .login-view { grid-template-columns: 1fr; }
  .login-art { min-height: 36vh; }
  .login-mark { font-size: 82px; }
  .orbit { width: 300px; }
  .orbit-a { width: 190px; }
  .orbit-b { width: 245px; }
  .orbit-c { width: 310px; }
  .login-route { display: none; }
  .login-panel { padding: 38px 25px 48px; }
  .login-panel h1 { font-size: 38px; }
  .login-foot { margin-top: 36px; }

  .topbar { gap: 12px; padding: 0 13px; }
  .menu-button { display: inline-block; }
  .brand-copy { display: none; }
  .project-picker { margin-left: 0; }
  .project-picker > span { display: none; }
  .project-picker select { width: min(190px, 36vw); }
  .connection-text, .connection span:last-child { display: none; }
  .top-actions .button:first-child { display: none; }

  .workspace { display: block; }
  .rail { position: fixed; z-index: 40; top: 64px; bottom: 0; left: 0; width: min(290px, 84vw); height: auto; transform: translateX(-105%); transition: transform 0.22s ease; box-shadow: 16px 0 44px rgba(16,26,28,0.16); }
  .rail.is-open { transform: translateX(0); }
  .main-panel { padding: 0 13px 40px; }
  .view-tabs { top: 64px; overflow-x: auto; padding-right: 0; }
  .tab { padding: 0 9px; font-size: 11px; }
  .tab-spacer { display: none; }
  .view-tabs .button-primary { margin-left: auto; white-space: nowrap; }
  .view { padding-top: 18px; }
  .project-hero { grid-template-columns: 1fr; padding: 19px; }
  .progress-card { padding: 14px 0 0; border-top: 1px solid var(--line); border-left: 0; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .board { grid-template-columns: repeat(5, 235px); }
  .meeting-layout { grid-template-columns: 1fr; }
  .meeting-index { max-height: 230px; overflow-y: auto; }
  .meeting-list { display: grid; grid-template-columns: repeat(2, 1fr); }
  .meeting-room { min-height: 620px; }
  .event-row { grid-template-columns: 52px minmax(0, 1fr); }
  .event-type { grid-column: 2; }
  .event-summary { grid-column: 2; }
  .event-time { grid-column: 2; text-align: left; }
  .drawer-grid, .context-grid, .form-grid, .form-grid.three { grid-template-columns: 1fr; }
  .task-drawer { padding: 26px 20px 44px; }
}

@media (max-width: 560px) {
  .login-art { min-height: 27vh; }
  .login-mark { font-size: 64px; }
  .login-art > p { margin-top: 17px; }
  .field-row { flex-direction: column; }
  .field-row .button { height: 42px; }
  .login-panel h1 { font-size: 32px; }
  .lede { font-size: 13px; }
  .project-picker select { width: 145px; font-size: 11px; }
  .top-actions .button { padding: 0 8px; font-size: 10px; }
  .project-hero h1 { font-size: 30px; }
  .hero-copy p { font-size: 12px; }
  .stats-row { gap: 7px; }
  .stat-card { min-height: 78px; padding: 11px; }
  .stat-card strong { font-size: 23px; }
  .panel { padding: 14px; }
  .meeting-title-row { display: block; }
  .meeting-controls { justify-content: flex-start; margin-top: 10px; }
  .meeting-title-row h2 { font-size: 23px; }
  .meeting-list { grid-template-columns: 1fr; }
  .message { max-width: 95%; }
  .audit-head { display: block; }
  .audit-head .button { margin-top: 12px; }
  .modal { padding: 18px; }
  .modal-head h2 { font-size: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
