.think { margin: 0 0 14px; border-radius: var(--radius); }
.think-head {
  display: inline-flex; align-items: center; gap: 9px; height: 30px; padding: 0 10px 0 6px; margin-left: -6px;
  border-radius: 8px; color: var(--text-2); font-size: 13px; line-height: 1.3; transition: background 0.2s, color 0.2s;
}
.think-head:hover { background: rgba(255, 255, 255, 0.04); color: var(--text); }
.think-head .s-mark { width: 18px; height: 18px; }
.think-head .chev { width: 14px; height: 14px; color: var(--text-3); transition: transform 0.3s var(--ease); }
.think.is-open .think-head .chev { transform: rotate(180deg); }
.think-label { position: relative; }
.think.is-live .think-label {
  background: linear-gradient(90deg, var(--text-3) 0%, var(--text-3) 35%, var(--fg-strong) 50%, var(--text-3) 65%, var(--text-3) 100%);
  background-size: 250% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shimmer 2.2s linear infinite;
}
@keyframes shimmer { from { background-position: 125% 0; } to { background-position: -125% 0; } }

.think-body {
  display: grid; grid-template-rows: 0fr; opacity: 0;
  transition: grid-template-rows 0.4s var(--ease), opacity 0.3s ease, margin 0.3s;
}
.think.is-open .think-body { grid-template-rows: 1fr; opacity: 1; margin-top: 6px; }
.think-inner { overflow: hidden; min-height: 0; }
.think-text {
  position: relative; padding: 2px 0 2px 16px; margin-left: 3px; border-left: 1px solid var(--line-2);
  color: var(--text-3); font-size: 13px; line-height: 1.65; white-space: pre-wrap; word-wrap: break-word;
}
.think.is-live .think-text {
  max-height: 104px; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 38px); mask-image: linear-gradient(to bottom, transparent 0, #000 38px);
}
.think.is-live .think-text > span { display: block; }

.pending { display: inline-flex; align-items: center; gap: 10px; color: var(--text-3); font-size: 13px; height: 28px; }
.pending .s-mark { width: 18px; height: 18px; }

.msg-pause { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin: 14px 0 6px; padding: 14px 16px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--sand-dim); color: var(--text-2); font-size: 13px; line-height: 1.5; }
.msg-pause > div { flex: 1 1 220px; min-width: 0; }
.msg-pause b { color: var(--text); font-weight: 500; }
.msg-pause p { margin: 4px 0; }
.msg-pause small { display: block; color: var(--text-3); font-size: 11.5px; }
.msg-pause button { flex: none; }
.studio-wait { align-items: flex-start; flex-direction: column; gap: 12px; }
.studio-wait > div { flex: auto; }
.studio-wait button { max-width: 100%; min-height: var(--h); height: auto; padding: 5px 10px; white-space: normal; }

.md { color: var(--text); font-size: 14.5px; line-height: 1.7; word-wrap: break-word; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 12px; }
.md h2, .md h3, .md h4, .md h5 { margin: 22px 0 8px; font-weight: 600; letter-spacing: -0.01em; color: var(--fg-strong); line-height: 1.35; }
.md h2 { font-size: 18px; }
.md h3 { font-size: 16px; }
.md h4, .md h5 { font-size: 14.5px; }
.md ul, .md ol { margin: 0 0 12px; padding-left: 22px; }
.md li { margin: 3px 0; }
.md li::marker { color: var(--text-3); }
.md strong { color: var(--fg-strong); font-weight: 600; }
.md em { color: var(--text); }
.md a { color: var(--sand); text-decoration: underline; text-decoration-color: rgba(216, 188, 146, 0.35); text-underline-offset: 3px; }
.md a:hover { text-decoration-color: var(--sand); }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }
.md blockquote { margin: 0 0 12px; padding: 2px 0 2px 14px; border-left: 2px solid var(--line-3); color: var(--text-2); }
.md :not(pre) > code { font-size: 0.87em; padding: 2px 6px; border-radius: 5px; background: var(--bg-3); border: 1px solid var(--line); color: #e9dcc6; }
.md-table { overflow-x: auto; margin: 0 0 12px; border: 1px solid var(--line); border-radius: var(--radius); }
.md table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
.md th, .md td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--line); }
.md th { color: var(--text-2); font-weight: 500; background: var(--bg-1); }
.md tr:last-child td { border-bottom: 0; }

.md.is-streaming > :last-child::after,
.md.is-streaming:empty::after {
  content: ''; display: inline-block; width: 7px; height: 15px; margin-left: 3px; vertical-align: -2px;
  background: var(--sand); border-radius: 2px; animation: caret 1s steps(2) infinite;
}
.md.is-streaming > .code:last-child::after { display: none; }
@keyframes caret { 50% { opacity: 0; } }

.code { margin: 4px 0 14px; border-radius: var(--radius); border: 1px solid var(--line); background: #0c0c0e; overflow: hidden; }
.code-head { display: flex; align-items: center; justify-content: space-between; height: 34px; padding: 0 8px 0 14px; border-bottom: 1px solid var(--line); background: var(--bg-1); }
.code-head > span { font-family: var(--mono); font-size: 11.5px; color: var(--text-3); text-transform: lowercase; }
.code-copy { display: inline-flex; align-items: center; gap: 6px; flex: none; height: 24px; padding: 0 8px; border-radius: 6px; font-size: 12px; line-height: 1.3; white-space: nowrap; color: var(--text-3); transition: color 0.2s, background 0.2s; }
.code-copy:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.code-copy.ok { color: var(--green); }
.code-copy svg { width: 13px; height: 13px; }
.code pre { margin: 0; padding: 14px 16px; overflow-x: auto; font-size: 12.8px; line-height: 1.65; color: #d4d4d8; tab-size: 4; }
.run { margin: 0 0 20px; padding: 12px 15px 10px; border: 1px solid var(--line-2); border-radius: var(--radius); background: var(--bg-1); }
.run-head {
  display: flex; align-items: center; gap: 9px; min-height: 30px; width: calc(100% + 12px); padding: 0 6px; margin-left: -6px;
  border-radius: 6px; color: var(--text-2); font-size: 12px; text-align: left; transition: background 0.2s, color 0.2s;
}
.run-head:hover { background: rgba(255, 255, 255, 0.04); color: var(--text); }
.run-head-ic { display: grid; place-items: center; width: 18px; height: 18px; flex: none; color: var(--sand); }
.run-head-ic .s-mark { width: 18px; height: 18px; }
.run-head-ic svg { width: 16px; height: 16px; }
.run[data-status="done"] .run-head-ic { color: var(--green); }
.run[data-status="alert"] .run-head-ic { color: var(--amber); }
.run-label { flex: none; font-size: 13px; font-weight: 550; color: var(--text); }
.run-place { margin-left: auto; min-width: 0; font-family: var(--mono); font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.run-head .chev { width: 14px; height: 14px; color: var(--text-3); flex: none; transition: transform 0.3s var(--ease); }
.run.is-open .run-head .chev { transform: rotate(180deg); }
.run-summary { margin: 1px 0 0 27px; color: var(--text-2); font-size: 11.5px; line-height: 1.6; }
.run-issues { margin: 7px 0 0 27px; color: var(--amber); font-size: 11.5px; line-height: 1.5; }
.run-issues::before { content: '!'; margin-right: 7px; font-family: var(--mono); font-weight: 600; }
.run-compact { margin-top: 12px; }
.run-draft { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; margin: 0 0 9px; padding-left: 27px; color: var(--text-2); font-size: 12.5px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.run-toggle { min-height: 30px; margin: 5px 0 -3px 27px; color: var(--text-2); font-size: 11.5px; text-align: left; text-decoration: underline; text-decoration-color: var(--line-3); text-underline-offset: 4px; transition: color 0.2s; }
.run-toggle:hover, .run-toggle:focus-visible { color: var(--sand); }
.run-body { display: grid; grid-template-rows: 0fr; opacity: 0; transition: grid-template-rows 0.4s var(--ease), opacity 0.3s ease, margin 0.3s; }
.run.is-open .run-body { grid-template-rows: 1fr; opacity: 1; margin-top: 12px; }
.run-inner { overflow: hidden; min-height: 0; }
.run-history { color: var(--text-2); font-size: 12px; }
.run-step {
  display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; column-gap: 9px; row-gap: 1px;
  align-items: center; padding: 7px 0; color: var(--text-2); font-size: 12px; line-height: 1.5;
}
.run-step + .run-step { border-top: 1px solid var(--line); }
.run-ic { width: 18px; height: 18px; display: grid; place-items: center; color: var(--text-2); }
.run-ic svg { width: 14px; height: 14px; }
.run-ic .spinner { width: 12px; height: 12px; border-width: 1.5px; border-top-color: var(--sand); }
.run-step.is-passed .run-ic, .run-step.is-passed .run-state { color: var(--green); }
.run-step.is-error .run-ic, .run-step.is-error .run-state { color: var(--red); }
.run-step:is(.is-failed, .is-unavailable, .is-interrupted) .run-ic,
.run-step:is(.is-failed, .is-unavailable, .is-interrupted) .run-state { color: var(--amber); }
.run-step:is(.is-working, .is-pending) .run-state { color: var(--sand); }
.run-title { min-width: 0; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.run-state { font-size: 10.5px; text-align: right; }
.run-sum { grid-column: 2 / -1; min-width: 0; font-family: var(--mono); font-size: 10.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.run-sum:empty { display: none; }
.run-history .run-title, .run-history .run-sum { white-space: normal; overflow-wrap: anywhere; }
.run-comment { margin: 7px 0 10px 8px; padding: 2px 0 2px 18px; border-left: 1px solid var(--line-2); }
.run-comment-label { display: block; margin-bottom: 4px; font-family: var(--mono); color: var(--text-2); font-size: 10px; }
.run-comment.is-draft { border-left-color: var(--sand); }
.run-comment .md { color: var(--text-2); font-size: 12.5px; line-height: 1.65; }
.run-comment .md > :last-child { margin-bottom: 0; }
@media (max-width: 600px) {
  .run { padding: 10px 11px 8px; }
  .run-place { max-width: 40%; font-size: 10px; }
  .run-step { grid-template-columns: 16px minmax(0, 1fr); column-gap: 8px; }
  .run-state { grid-column: 2; text-align: left; }
  .run-sum { grid-column: 2; }
  .run-summary, .run-issues { margin-left: 0; }
  .run-draft { padding-left: 0; }
  .run-toggle { margin-left: 0; min-height: 36px; }
}
@media (prefers-reduced-motion: reduce) {
  .run-body, .run-head, .run-head .chev, .run-toggle { transition: none; }
  .run .spinner, .run .s-mark, .run .s-mark * { animation: none !important; }
}

.report {
  margin: 16px 0 4px; border-radius: var(--radius-lg); border: 1px solid var(--line-2); overflow: hidden;
  background: linear-gradient(180deg, rgba(216, 188, 146, 0.045), transparent 90px), var(--bg-1);
  animation: rise-in 0.45s var(--ease) backwards;
}
.report-head { display: flex; align-items: center; gap: 12px; padding: 12px 14px; }
.report-ic {
  width: 32px; height: 32px; flex: none; display: grid; place-items: center; border-radius: 9px;
  color: var(--sand); background: var(--sand-dim); border: 1px solid rgba(216, 188, 146, 0.2);
}
.report-ic svg { width: 16px; height: 16px; }
.report-title { flex: 1; min-width: 0; display: grid; gap: 1px; line-height: 1.35; }
.report-title b { font-weight: 600; font-size: 13.5px; color: var(--fg-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.report-title span { font-size: 12px; color: var(--text-3); }
.report i { font-style: normal; font-family: var(--mono); font-size: 11.5px; }
.report i.add { color: var(--green); }
.report i.del { color: var(--red); }

.report-verification { border-top: 1px solid var(--line); font-size: 12px; line-height: 1.5; }
.report-verification summary { display: flex; align-items: center; gap: 8px; padding: 10px 14px; color: var(--green); cursor: pointer; list-style: none; }
.report-verification summary::-webkit-details-marker { display: none; }
.report-verification summary::after { content: '+'; margin-left: auto; }
.report-verification[open] summary::after { content: '−'; }
.report-verification summary svg { width: 15px; height: 15px; flex: none; }
.report-verification.has-issues summary, .verification-issue { color: var(--amber); }
.verification-list { display: grid; gap: 10px; padding: 0 14px; overflow-wrap: anywhere; color: var(--text-2); }
.verification-item b { display: block; margin-bottom: 3px; font-weight: 500; }
.report-verification p { margin: 10px 14px; color: var(--text-3); }
.report-list { border-top: 1px solid var(--line); }
.report-row + .report-row { border-top: 1px solid var(--line); }
.report-line {
  width: 100%; display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 8px 14px; text-align: left;
  font-size: 12.5px; transition: background 0.15s;
}
.report-line:not(:disabled):hover { background: rgba(255, 255, 255, 0.025); }
.report-line:disabled { cursor: default; }
.chg {
  flex: none; height: 19px; padding: 0 6px; border-radius: 4px; display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 10.5px; font-weight: 500; line-height: 1; color: var(--text-2); box-shadow: inset 0 0 0 1px var(--line-2);
}
.chg::before { content: ''; width: 5px; height: 5px; border-radius: 50%; flex: none; background: var(--tone, var(--text-3)); }
.chg-create { --tone: var(--green); }
.chg-edit { --tone: var(--blue); }
.chg-props { --tone: var(--sand); }
.chg-delete { --tone: var(--red); }
.report-path { flex: 1; min-width: 0; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; direction: ltr; }
.report-path b { font-weight: 500; color: var(--text); }
.report-class { flex: none; font-size: 11.5px; color: var(--text-3); }
.report-stat { flex: none; display: inline-flex; gap: 6px; max-width: 34%; font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.report-line .chev { width: 14px; height: 14px; flex: none; color: var(--text-3); transition: transform 0.3s var(--ease); }
.report-row.is-open .report-line .chev { transform: rotate(180deg); }
.chev-pad { width: 14px; flex: none; }

.report-code { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.4s var(--ease); }
.report-row.is-open .report-code { grid-template-rows: 1fr; }
.report-code-inner { overflow: hidden; min-height: 0; }
.report-code-inner .code { margin: 0 14px 12px; }
.report-code-inner pre { max-height: 360px; overflow: auto; }
.source-diff .code-head { gap: 6px; min-height: 36px; height: auto; padding: 6px 8px; flex-wrap: wrap; }
.source-diff .code-head > span { text-transform: none; }
.source-diff .code-copy { color: var(--text-2); }
.diff-note, .diff-gap { padding: 10px 12px; font-size: 11.5px; line-height: 1.5; color: var(--text-2); }
.diff-note { border-bottom: 1px solid var(--line); }
.diff-scroll { max-height: 360px; overflow: auto; font-family: var(--mono); font-size: 12px; line-height: 1.7; tab-size: 4; }
.diff-line { display: flex; min-width: 100%; width: max-content; }
.diff-line code { white-space: pre; padding-right: 12px; color: #d4d4d8; }
.diff-num { width: 4.5ch; flex: none; text-align: right; padding-right: 1ch; color: var(--text-2); user-select: none; border-right: 1px solid var(--line); }
.diff-marker { width: 3ch; flex: none; text-align: center; user-select: none; }
.diff-add { background: rgba(111, 207, 151, 0.10); }
.diff-del { background: rgba(240, 122, 115, 0.10); }
.diff-add .diff-marker { color: var(--green); }
.diff-del .diff-marker { color: var(--red); }
.diff-gap { background: var(--bg-2); }

.report-foot {
  display: flex; align-items: center; gap: 8px; padding: 9px 14px; border-top: 1px solid var(--line);
  font-size: 11.5px; color: var(--text-3); background: rgba(0, 0, 0, 0.15);
}
.report-foot svg { width: 13px; height: 13px; flex: none; }
.report-foot .kbd { font-size: 10px; }
@media (max-width: 600px) {
  .report-class { display: none; }
}

.tk-com { color: #6a6a73; font-style: italic; }
.tk-str { color: #b5d49a; }
.tk-num { color: #e8b27a; }
.tk-kw { color: #d7a8e0; }
.tk-bi { color: #8fc1e8; }
.tk-fn { color: #eedba8; }
