:root {
  color-scheme: light;
  --bg: #f7f7f4;
  --surface: #ffffff;
  --surface-2: #f0f4f3;
  --text: #1f2423;
  --muted: #66706d;
  --line: #dce4e1;
  --teal: #16756b;
  --teal-strong: #0f5c54;
  --coral: #b85c4b;
  --amber: #9b6b1e;
  --shadow: 0 10px 30px rgba(23, 37, 35, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

button,
textarea {
  font: inherit;
}

.button-link {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border: 1px solid #b8d3ce;
  border-radius: 8px;
  background: #edf7f4;
  color: var(--teal-strong);
  font-weight: 720;
  text-decoration: none;
}

.button-link:hover {
  border-color: #8dc2ba;
  background: #e4f2ef;
}

.auth-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-card h1 {
  margin: 0;
  font-size: 24px;
}

.auth-card p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.auth-card label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.auth-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.auth-message {
  min-height: 20px;
  color: var(--coral);
}

.share-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(31, 36, 35, 0.48);
}

.share-modal.hidden {
  display: none;
}

.share-modal-card {
  width: min(920px, 100%);
  max-height: min(92vh, 980px);
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 18px 60px rgba(23, 37, 35, 0.2);
}

.share-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.share-modal-head strong,
.share-modal-head span {
  display: block;
}

.share-modal-head strong {
  color: var(--text);
  font-size: 18px;
}

.share-modal-head span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.share-modal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.share-image-stage {
  min-height: 0;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f4f6f5;
}

.share-image-stage img {
  display: block;
  width: min(100%, 520px);
  height: auto;
  margin: 0 auto;
  border: 1px solid #d0ddd9;
  border-radius: 8px;
  background: #fff;
}

.share-card-image {
  width: 1080px;
  padding: 48px;
  background: #f7f7f4;
  color: #1f2423;
  font-family:
    Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

.share-image-header,
.share-state-card,
.share-turn-card,
.share-image-footer {
  border: 1px solid #dce4e1;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(23, 37, 35, 0.08);
}

.share-image-header {
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 28px;
  padding: 34px;
}

.share-image-kicker {
  display: inline-flex;
  color: #0f5c54;
  font-size: 22px;
  font-weight: 800;
}

.share-image-header h1 {
  margin: 12px 0 10px;
  color: #1f2423;
  font-size: 44px;
  line-height: 1.2;
  letter-spacing: 0;
}

.share-image-header p {
  margin: 0;
  color: #66706d;
  font-size: 24px;
  line-height: 1.55;
}

.share-image-meta {
  display: flex;
  align-content: start;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.share-image-meta span,
.share-mini-row em,
.share-chain-row em {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  padding: 0 13px;
  border-radius: 8px;
  background: #edf7f4;
  color: #0f5c54;
  font-size: 20px;
  font-style: normal;
  font-weight: 680;
}

.share-state-card {
  margin-top: 18px;
  padding: 24px 28px;
}

.share-state-card > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.share-state-card strong {
  color: #1f2423;
  font-size: 26px;
}

.share-state-card span {
  color: #0f5c54;
  font-size: 24px;
  font-weight: 760;
}

.share-state-card p {
  margin: 12px 0 0;
  color: #45504d;
  font-size: 22px;
  line-height: 1.5;
}

.share-mini-row,
.share-chain-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.share-mini-row em {
  background: #f0f4f3;
  color: #66706d;
  font-size: 18px;
}

.share-turns {
  display: grid;
  gap: 18px;
  margin-top: 22px;
}

.share-turn-card {
  padding: 28px;
}

.share-turn-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
  color: #66706d;
  font-size: 20px;
}

.share-turn-head strong {
  flex: 0 0 auto;
  color: #0f5c54;
  font-size: 24px;
}

.share-turn-head span {
  text-align: right;
  line-height: 1.4;
}

.share-line {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 18px;
  align-items: start;
  margin-top: 16px;
}

.share-line span {
  color: #66706d;
  font-size: 22px;
  font-weight: 680;
}

.share-line p {
  margin: 0;
  color: #1f2423;
  font-size: 28px;
  line-height: 1.55;
  font-weight: 680;
}

.share-line.reply p {
  font-size: 32px;
  font-weight: 780;
}

.share-line.coach p {
  color: #0f5c54;
}

.share-chain-row {
  margin-left: 110px;
}

.share-chain-row em {
  background: #f0f4f3;
  color: #66706d;
  font-size: 18px;
  font-weight: 620;
}

.share-image-footer {
  display: flex;
  justify-content: space-between;
  margin-top: 22px;
  padding: 18px 24px;
  color: #66706d;
  font-size: 18px;
}

.app-shell {
  width: min(1120px, calc(100vw - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px 0;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 16px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 72px;
}

.topbar h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
  font-weight: 750;
}

.topbar p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.status {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.user-pill {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid #bdd8d2;
  border-radius: 8px;
  background: #edf7f4;
  color: var(--teal-strong);
  font-size: 13px;
  font-weight: 680;
}

#modelStatus {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  border-radius: 6px;
  font-size: 13px;
}

button {
  border: 0;
  border-radius: 6px;
  min-height: 38px;
  padding: 0 14px;
  color: #fff;
  background: var(--teal);
  cursor: pointer;
  transition:
    background 120ms ease,
    transform 120ms ease,
    opacity 120ms ease;
}

button:hover {
  background: var(--teal-strong);
}

button:active {
  transform: translateY(1px);
}

button.secondary {
  background: #e7eeeb;
  color: var(--teal-strong);
}

button.secondary:hover {
  background: #dae7e3;
}

button.secondary.active {
  background: #d3e7e2;
  color: var(--teal-strong);
  box-shadow: inset 0 0 0 1px #9dc8c0;
}

button.warning {
  background: #f4e9dd;
  color: var(--amber);
}

button.warning:hover {
  background: #ead9c6;
}

button.danger {
  background: #f3e4e0;
  color: var(--coral);
}

button.danger:hover {
  background: #ead2cc;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
  transform: none;
}

.workspace {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(360px, 1fr) auto;
  gap: 14px;
}

.hidden {
  display: none !important;
}

.library {
  min-height: 0;
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 14px;
}

.knowledge {
  min-height: 0;
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 14px;
}

.session-panel,
.session-detail,
.graph-panel,
.graph-detail {
  min-height: 360px;
  max-height: calc(100vh - 130px);
  overflow: auto;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel-head,
.detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-head h2 {
  margin: 0;
  font-size: 17px;
}

.session-list {
  display: grid;
  gap: 8px;
}

.panel-subhead {
  display: grid;
  gap: 3px;
  padding: 6px 0 2px;
}

.panel-subhead strong {
  font-size: 14px;
}

.panel-subhead span {
  color: var(--muted);
  font-size: 12px;
}

.usage-panel {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid #bdd8d2;
  border-radius: 8px;
  background: #f4faf8;
}

.usage-panel > div:first-child {
  display: grid;
  gap: 7px;
}

.usage-panel strong,
.knowledge-guide strong {
  color: var(--text);
}

.usage-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.usage-points {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.usage-points span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--teal-strong);
  font-size: 12px;
  font-weight: 620;
}

.graph-usage span {
  color: #5b6460;
}

.asset-overview {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

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

.standard-banner {
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 1px solid var(--teal-soft);
  border-radius: 8px;
  background: #f7fbfa;
}

.standard-banner strong {
  color: var(--text);
  font-size: 13px;
}

.standard-banner p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.asset-summary-card,
.asset-latest {
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.asset-summary-card strong,
.asset-latest strong {
  color: var(--text);
  font-size: 13px;
}

.asset-summary-card p,
.asset-latest p,
.asset-latest span {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.asset-latest.compact {
  color: var(--muted);
  font-size: 12px;
}

.asset-block,
.asset-flow,
.asset-pipeline,
.learning-policy,
.knowledge-guide {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.asset-pipeline {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
}

.pipeline-step {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  gap: 6px 8px;
  align-items: center;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.pipeline-step > span {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #dcebe7;
  color: var(--teal-strong);
  font-size: 12px;
  font-weight: 700;
}

.pipeline-step strong {
  font-size: 12px;
  line-height: 1.25;
}

.pipeline-step em {
  font-style: normal;
  color: var(--teal-strong);
  font-size: 12px;
}

.pipeline-step p {
  grid-column: 2 / -1;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.asset-block {
  display: grid;
  gap: 9px;
  padding: 12px;
}

.asset-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.asset-head > div {
  display: grid;
  gap: 3px;
}

.asset-head strong {
  font-size: 15px;
}

.asset-head span,
.asset-block p,
.asset-case span,
.asset-flow li {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.asset-block p {
  margin: 0;
}

.asset-status,
.asset-stats,
.asset-groups {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.asset-case {
  display: inline-grid;
  gap: 2px;
  width: min(100%, 220px);
  padding: 7px 8px;
  border-radius: 6px;
  background: #fff;
  border: 1px solid var(--line);
}

.asset-case strong {
  font-size: 12px;
  line-height: 1.3;
}

.asset-case small {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.latest-hit,
.learning-policy {
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.latest-hit {
  display: grid;
  gap: 4px;
}

.latest-hit strong,
.learning-policy strong,
.promotion-list > strong {
  color: var(--teal-strong);
  font-size: 13px;
}

.latest-hit span,
.latest-hit p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.latest-hit.muted {
  color: var(--muted);
  font-size: 12px;
}

.promotion-list {
  display: grid;
  gap: 6px;
}

.promotion-card {
  display: grid;
  min-height: 46px;
  padding: 8px 10px;
  text-align: left;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: none;
}

.promotion-card:hover {
  background: #edf7f4;
  border-color: #a7d2cb;
}

.promotion-card span {
  font-size: 12px;
  font-weight: 680;
}

.promotion-card small {
  color: var(--muted);
  font-size: 11px;
}

.learning-policy ul {
  margin: 7px 0 0 18px;
  padding: 0;
}

.learning-policy li {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.asset-flow {
  padding: 10px 12px;
}

.asset-flow summary {
  color: var(--teal-strong);
  cursor: pointer;
  font-size: 13px;
  font-weight: 680;
}

.asset-flow ol {
  margin: 8px 0 0 18px;
  padding: 0;
}

.knowledge-guide {
  flex-basis: 100%;
  padding: 12px;
  display: grid;
  gap: 8px;
}

.knowledge-guide strong {
  display: block;
  font-size: 14px;
}

.knowledge-guide p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.graph-stats {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.session-card,
.node-card {
  display: grid;
  gap: 5px;
  width: 100%;
  min-height: 88px;
  padding: 12px;
  text-align: left;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: none;
}

.session-card:hover,
.session-card.active,
.node-card:hover,
.node-card.active {
  background: #edf7f4;
  border-color: #a7d2cb;
}

.node-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.session-user-group {
  display: grid;
  gap: 8px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.session-user-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.session-user-head strong {
  color: var(--teal-strong);
  font-size: 13px;
}

.session-user-head span {
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  padding: 0 7px;
  border-radius: 5px;
  background: var(--surface-2);
}

.session-user-items {
  display: grid;
  gap: 8px;
}

.node-editor,
.edge-editor,
.audit-list {
  padding-bottom: 16px;
}

.node-editor + .edge-editor,
.edge-editor + .audit-list {
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.node-editor h2,
.edge-editor h2,
.audit-list h2 {
  margin: 0;
  font-size: 17px;
}

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

.form-grid label,
.field-block {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.field-block {
  margin-top: 10px;
}

.field-input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  color: var(--text);
  background: #fff;
  outline: none;
  line-height: 1.5;
}

.field-input[readonly] {
  color: var(--muted);
  background: var(--surface-2);
}

.field-input:focus {
  border-color: #8dc2ba;
  box-shadow: 0 0 0 3px rgba(22, 117, 107, 0.12);
}

.profile-editor {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.edge-form {
  grid-template-columns: 1fr 1fr 140px 90px;
}

.edge-list,
.audit-items {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.edge-row,
.audit-item {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.edge-row > div {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.audit-item {
  grid-template-columns: 160px 1fr 170px;
  color: var(--muted);
  font-size: 13px;
}

.audit-item strong {
  color: var(--text);
  word-break: break-word;
}

.session-title {
  font-weight: 680;
  line-height: 1.35;
  word-break: break-word;
}

.session-card-head {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: start;
}

.session-seq {
  min-width: 28px;
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #dcebe7;
  color: var(--teal-strong);
  font-size: 12px;
  font-weight: 750;
}

.session-meta {
  color: var(--muted);
  font-size: 12px;
}

.session-time {
  color: #8a9692;
  font-size: 11px;
}

.session-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.mini-chip {
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  padding: 0 7px;
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
}

.mini-chip.gold {
  background: #f7edd8;
  color: var(--amber);
}

.mini-chip.live {
  background: #dcebe7;
  color: var(--teal-strong);
}

.detail-meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.detail-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.check-row {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.title-input,
.summary-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  background: #fff;
  outline: none;
}

.title-input {
  max-width: 520px;
  font-size: 18px;
  font-weight: 720;
}

.summary-input {
  resize: vertical;
  line-height: 1.5;
  margin-bottom: 12px;
}

.title-input:focus,
.summary-input:focus {
  border-color: #8dc2ba;
  box-shadow: 0 0 0 3px rgba(22, 117, 107, 0.12);
}

.review-list {
  display: grid;
  gap: 12px;
}

.system-flow {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.system-flow > summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 14px;
  color: var(--teal-strong);
  cursor: pointer;
  font-size: 14px;
  font-weight: 720;
}

.system-flow > summary small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  text-align: right;
}

.flow-map {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0 14px 12px;
  align-items: stretch;
}

.flow-node,
.flow-parallel {
  min-width: 0;
}

.flow-node {
  flex: 1 1 190px;
  display: grid;
  align-content: start;
  gap: 7px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.flow-node > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.flow-node span {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #dcebe7;
  color: var(--teal-strong);
  font-size: 12px;
  font-weight: 760;
}

.flow-node em {
  max-width: 120px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flow-node strong {
  color: var(--text);
  font-size: 14px;
  line-height: 1.35;
}

.flow-node p,
.flow-loop span,
.flow-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.flow-arrow {
  flex: 0 0 24px;
  position: relative;
  min-height: 32px;
  align-self: center;
}

.flow-arrow::before {
  content: "";
  position: absolute;
  top: 50%;
  right: 5px;
  left: 2px;
  height: 1px;
  background: #adc8c2;
}

.flow-arrow::after {
  content: "";
  position: absolute;
  top: calc(50% - 5px);
  right: 2px;
  width: 10px;
  height: 10px;
  border-top: 1px solid #adc8c2;
  border-right: 1px solid #adc8c2;
  transform: rotate(45deg);
}

.flow-arrow.merge {
  flex: 1 0 100%;
  min-height: 18px;
}

.flow-arrow.merge::before {
  right: 45%;
  left: 45%;
}

.flow-arrow.merge::after {
  right: calc(50% - 5px);
  top: 4px;
  transform: rotate(135deg);
}

.flow-parallel {
  flex: 1 0 100%;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 10px;
  border: 1px dashed #b9cec9;
  border-radius: 8px;
  background: #f6faf8;
}

.flow-loop {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 14px 10px;
  padding: 10px 12px;
  border: 1px solid #e5d2ae;
  border-radius: 8px;
  background: #fff8eb;
}

.flow-loop strong {
  flex: 0 0 auto;
  color: var(--amber);
  font-size: 13px;
}

.flow-note {
  padding: 0 14px 14px;
}

.turn-list {
  min-height: 360px;
  max-height: calc(100vh - 210px);
  overflow: auto;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.empty {
  min-height: 320px;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
}

.empty.compact {
  min-height: 160px;
  padding: 18px;
}

.turn {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.turn + .turn {
  margin-top: 12px;
}

.turn-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
}

.latency {
  color: var(--teal);
}

.line {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 10px;
  align-items: start;
  margin: 10px 0;
}

.label {
  color: var(--muted);
  font-size: 13px;
  padding-top: 2px;
}

.customer-text,
.ai-reply {
  line-height: 1.6;
  word-break: break-word;
}

.ai-reply {
  font-size: 18px;
  font-weight: 680;
}

.chips,
.turn-chain {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 0 86px;
}

.turn-chain {
  align-items: center;
}

.trace-panel {
  margin: 12px 0 0 86px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.trace-panel summary {
  min-height: 38px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  color: var(--teal-strong);
  font-size: 13px;
  font-weight: 680;
  cursor: pointer;
}

.trace-grid {
  display: grid;
  gap: 10px;
  padding: 0 12px 12px;
}

.trace-panel summary {
  justify-content: space-between;
  gap: 10px;
}

.trace-panel summary small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.decision-chain {
  display: grid;
  gap: 10px;
  padding: 0 12px 12px;
}

.decision-overview,
.explain-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.decision-overview {
  display: grid;
  gap: 9px;
  padding: 12px;
}

.decision-overview > div:first-child {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.decision-overview h3,
.explain-card h3 {
  margin: 0;
  color: var(--text);
  font-size: 15px;
  line-height: 1.35;
}

.decision-overview p,
.explain-card p,
.trace-muted {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

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

.decision-facts > div {
  display: grid;
  gap: 3px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfb;
}

.decision-facts strong,
.explain-columns strong,
.inline-list span {
  color: var(--teal-strong);
  font-size: 12px;
}

.decision-facts span {
  color: var(--text);
  font-size: 12px;
  line-height: 1.45;
}

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

.explain-card {
  display: grid;
  gap: 8px;
  padding: 10px;
}

.explain-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.explain-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 680;
}

.explain-head strong {
  color: var(--teal-strong);
  font-size: 12px;
  text-align: right;
}

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

.explain-columns > div,
.skill-item,
.evidence-item {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfb;
  padding: 8px;
}

.explain-columns ul {
  margin: 6px 0 0 16px;
  padding: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.skill-list,
.evidence-list {
  display: grid;
  gap: 8px;
}

.skill-item strong,
.evidence-item strong {
  color: var(--text);
  font-size: 12px;
}

.skill-item p,
.evidence-item p {
  margin-top: 4px;
}

.inline-list {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.inline-list em {
  font-style: normal;
  color: var(--muted);
  background: var(--surface-2);
  border-radius: 5px;
  padding: 2px 6px;
  font-size: 11px;
}

.raw-trace {
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fff;
}

.raw-trace > summary {
  min-height: 34px;
}

.trace-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.trace-section h3 {
  margin: 0;
  padding: 8px 10px;
  color: var(--muted);
  background: var(--surface-2);
  font-size: 13px;
}

.trace-section pre {
  max-height: 360px;
  overflow: auto;
  margin: 0;
  padding: 10px;
  color: #27302e;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.mind-layer {
  padding-bottom: 10px;
}

.mind-layer p {
  margin: 8px 10px;
  color: #27302e;
  font-size: 13px;
  line-height: 1.55;
}

.mind-head,
.mind-meta,
.mind-columns {
  display: flex;
  gap: 8px;
  margin: 8px 10px;
  flex-wrap: wrap;
  align-items: center;
}

.mind-head strong {
  color: var(--teal-strong);
  font-size: 16px;
}

.mind-head span {
  color: var(--muted);
  font-size: 13px;
}

.mind-columns {
  align-items: stretch;
}

.mind-columns > div {
  flex: 1 1 220px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: #fbfcfb;
}

.mind-columns strong {
  color: #27302e;
  font-size: 13px;
}

.mind-columns ul {
  margin: 6px 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.chip {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
}

.chip.intent {
  color: var(--teal-strong);
  border-color: #bdd8d2;
  background: #edf7f4;
}

.chip.guard {
  color: var(--coral);
  border-color: #ebcbc3;
  background: #fff1ee;
}

.chain-chip {
  font-weight: 620;
}

.chip.model {
  color: var(--teal-strong);
  border-color: #bdd8d2;
  background: #edf7f4;
}

.chip.mind {
  color: #5c4b7d;
  border-color: #d9d0eb;
  background: #f5f1fb;
}

.chip.action {
  color: #9b6715;
  border-color: #ead8b7;
  background: #fff8ec;
}

.chip.skill {
  color: #356366;
  border-color: #c8dcde;
  background: #f1f8f8;
}

.chip.evidence,
.chip.graph {
  color: #5b6460;
  border-color: #d8dfdc;
  background: #f7f9f8;
}

.chip.quality {
  color: #2f6a49;
  border-color: #c8dfd0;
  background: #f1faf4;
}

.chip.review {
  color: #9b6715;
  border-color: #ead8b7;
  background: #fff8ec;
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 14px 0 0 86px;
}

.rewrite-box {
  display: none;
  margin: 12px 0 0 86px;
  gap: 8px;
}

.rewrite-box.active {
  display: grid;
}

.rewrite-box textarea,
.composer textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--text);
  background: #fff;
  outline: none;
  line-height: 1.5;
}

.rewrite-box textarea:focus,
.composer textarea:focus {
  border-color: #8dc2ba;
  box-shadow: 0 0 0 3px rgba(22, 117, 107, 0.12);
}

.composer {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  box-shadow: var(--shadow);
}

.composer label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

.composer-row {
  display: grid;
  grid-template-columns: 1fr 96px;
  gap: 10px;
  align-items: stretch;
}

.composer-row button {
  min-height: 78px;
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100vw - 20px, 720px);
    padding: 12px 0;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .status {
    justify-content: flex-start;
  }

  .turn-list {
    max-height: calc(100vh - 250px);
    padding: 12px;
  }

  .library,
  .knowledge {
    grid-template-columns: 1fr;
  }

  .session-panel,
  .session-detail,
  .graph-panel,
  .graph-detail {
    max-height: none;
    min-height: 0;
  }

  .form-grid,
  .edge-form,
  .audit-item,
  .asset-summary,
  .asset-pipeline,
  .flow-parallel,
  .decision-grid,
  .decision-facts,
  .explain-columns {
    grid-template-columns: 1fr;
  }

  .system-flow > summary {
    align-items: flex-start;
    flex-direction: column;
    padding: 9px 14px;
  }

  .system-flow > summary small {
    text-align: left;
  }

  .flow-map {
    flex-direction: column;
  }

  .flow-node,
  .flow-parallel,
  .flow-arrow {
    flex: 0 0 auto;
  }

  .flow-arrow {
    min-height: 18px;
  }

  .flow-arrow::before {
    top: 1px;
    bottom: 1px;
    left: 50%;
    width: 1px;
    height: auto;
  }

  .flow-arrow::after {
    top: auto;
    right: auto;
    bottom: 0;
    left: calc(50% - 5px);
    transform: rotate(135deg);
  }

  .flow-loop {
    align-items: flex-start;
    flex-direction: column;
  }

  .detail-head {
    align-items: stretch;
    flex-direction: column;
  }

  .detail-actions {
    justify-content: flex-start;
  }

  .line {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .chips,
  .turn-chain,
  .trace-panel,
  .actions,
  .rewrite-box {
    margin-left: 0;
  }

  .trace-panel summary {
    align-items: flex-start;
    flex-direction: column;
    padding: 9px 12px;
  }

  .composer-row {
    grid-template-columns: 1fr;
  }

  .composer-row button {
    min-height: 44px;
  }
}
