:root {
  --bg: #eef2f6;
  --panel: #ffffff;
  --surface: #f8fafc;
  --surface-strong: #f1f5f9;
  --line: #dfe6ef;
  --line-strong: #c8d2df;
  --text: #172033;
  --muted: #657287;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --accent-soft: #e3f4f0;
  --blue: #285f9f;
  --danger: #b42318;
  --danger-bg: #fde7e5;
  --warn: #9a5b00;
  --warn-bg: #fff2d6;
  --shadow: 0 10px 28px rgba(20, 30, 48, 0.08);
  --shadow-soft: 0 1px 2px rgba(20, 30, 48, 0.06);
  --radius: 8px;
  --beian-footer-height: 34px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
  overflow: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 17px) 50%,
    calc(100% - 12px) 50%;
  background-repeat: no-repeat;
  background-size: 5px 5px;
  padding-right: 34px;
}

select:disabled {
  background-color: var(--surface-strong);
  color: #94a3b8;
  opacity: 1;
}

button {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  color: var(--text);
  min-height: 34px;
  padding: 6px 10px;
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease, box-shadow 140ms ease;
}

button:hover:not(:disabled) {
  border-color: var(--accent);
  box-shadow: var(--shadow-soft);
}

button:disabled {
  color: #9aa3b2;
  cursor: not-allowed;
}

button.danger {
  color: var(--danger);
  background: var(--danger-bg);
  border-color: #f4b8b2;
}

.primary-button {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  font-weight: 700;
}

.primary-button:hover:not(:disabled) {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: #ffffff;
}

.primary-button:disabled {
  background: #cbd5df;
  border-color: #cbd5df;
  color: #ffffff;
}

.secondary-button {
  background: #eef6ff;
  border-color: #b9d5f3;
  color: var(--blue);
  font-weight: 700;
}

.subtle-button {
  background: var(--surface);
  color: var(--muted);
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 24px calc(24px + var(--beian-footer-height));
}

.login-panel {
  width: min(100%, 360px);
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  display: grid;
  gap: 16px;
}

.login-panel h1,
h1,
h2,
p {
  margin: 0;
}

h1,
h2 {
  font-size: 18px;
  font-weight: 750;
}

.login-panel label,
.new-task label,
.execution-selectors label,
.execution-switch label,
.reply-execution-controls label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.login-panel input,
.session-search input,
.mobile-session-search,
.mobile-session-switcher,
.composer textarea,
.execution-selectors select,
.execution-switch select,
.reply-execution-controls select,
.new-task textarea,
.new-task input,
.new-task select,
.question-card input,
.question-card select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  background: #fff;
  color: var(--text);
}

select.mobile-session-switcher,
.new-task select,
.execution-selectors select,
.execution-switch select,
.reply-execution-controls select,
.question-card select {
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 17px) 50%,
    calc(100% - 12px) 50%;
  background-repeat: no-repeat;
  background-size: 5px 5px;
  padding-right: 34px;
}

.login-panel input,
.execution-selectors label > select,
.new-task label > input,
.new-task label > select,
.new-task label > textarea,
.execution-switch select,
.reply-execution-controls select {
  margin-top: 5px;
}

.login-panel input:focus,
.session-search input:focus,
.mobile-session-search:focus,
.mobile-session-switcher:focus,
.composer textarea:focus,
.execution-selectors select:focus,
.execution-switch select:focus,
.reply-execution-controls select:focus,
.new-task textarea:focus,
.new-task input:focus,
.new-task select:focus,
.question-card input:focus,
.question-card select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.13);
  outline: 0;
}

.error {
  min-height: 20px;
  color: var(--danger);
}

.app-shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  height: 100vh;
  min-height: 0;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0) 180px),
    var(--bg);
}

.app-shell.is-new-task-open {
  grid-template-columns: 320px minmax(0, 1fr) 340px;
}

.sidebar,
.right-panel {
  background: rgba(255, 255, 255, 0.94);
  border-right: 1px solid var(--line);
  min-width: 0;
}

.sidebar {
  min-height: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding-bottom: var(--beian-footer-height);
}

.right-panel {
  border-right: 0;
  border-left: 1px solid var(--line);
  display: none;
  height: 100vh;
  overflow: auto;
  padding-bottom: var(--beian-footer-height);
  box-shadow: -14px 0 30px rgba(20, 30, 48, 0.07);
}

.app-shell.is-new-task-open .right-panel {
  display: block;
}

.sidebar-header,
.detail-header,
.new-task {
  padding: 16px;
}

.sidebar-header,
.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}

.sidebar-header {
  min-height: 72px;
}

.sidebar-header p,
.detail-header p,
.status-line {
  color: var(--muted);
  margin-top: 4px;
}

.sidebar-actions,
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.detail-heading {
  min-width: 0;
}

.detail-heading h2,
.detail-heading p {
  overflow-wrap: anywhere;
}

.mobile-detail-nav {
  display: none;
}

.mobile-session-switcher {
  min-width: 0;
  font-weight: 700;
  text-overflow: ellipsis;
}

.mobile-session-search {
  min-width: 0;
}

#workspace-select {
  font-weight: 700;
}

.icon-button {
  width: 34px;
  padding: 0;
}

.cache-clear-button {
  color: var(--blue);
}

.new-task-toggle {
  min-width: 72px;
}

.new-task-toggle.is-active {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: #ffffff;
}

.filters {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.filter {
  min-width: 0;
  border-color: transparent;
  background: transparent;
  padding: 6px 4px;
  color: var(--muted);
  font-weight: 700;
}

.filter.is-active {
  background: var(--panel);
  border-color: var(--line);
  color: var(--accent);
  box-shadow: var(--shadow-soft);
}

.session-search {
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.session-search-status {
  color: var(--muted);
  font-size: 12px;
  min-height: 18px;
  padding-top: 4px;
}

.session-search-status.is-error {
  color: var(--danger);
}

.counts {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding: 12px;
  background: #fbfcfe;
  border-bottom: 1px solid var(--line);
}

.count-item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  box-shadow: var(--shadow-soft);
}

.count-item strong {
  display: block;
  font-size: 18px;
  line-height: 1.1;
}

.count-item span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

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

.session-item {
  width: 100%;
  display: block;
  text-align: left;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 11px 12px;
  margin-bottom: 6px;
  background: transparent;
}

.session-item.is-live {
  border-color: #efd59b;
  background: #fffbf2;
}

.session-item.is-selected {
  background: #ffffff;
  border-color: #8ecdc2;
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.12);
}

.session-item:hover:not(.is-selected) {
  background: #ffffff;
  border-color: var(--line);
}

.session-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.session-item strong {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
}

.session-item .session-chip {
  display: inline-flex;
  align-items: center;
  width: auto;
  max-width: 100%;
  min-height: 19px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  margin-top: 0;
  padding: 3px 6px;
  text-transform: uppercase;
}

.session-item .running-chip {
  display: inline-flex;
  align-items: center;
  width: auto;
  max-width: 100%;
  min-height: 19px;
  gap: 5px;
  border: 1px solid #e5b567;
  border-radius: 999px;
  background: var(--warn-bg);
  color: var(--warn);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  margin-top: 0;
  padding: 3px 6px;
}

.running-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--warn);
  animation: runningBlink 0.8s ease-in-out infinite alternate;
}

.session-chip-active {
  border-color: #8ecdc2 !important;
  background: var(--accent-soft) !important;
  color: var(--accent-strong) !important;
}

.session-item .session-chip-inactive {
  border-color: var(--line);
  background: #f7f8fa;
  color: var(--muted);
}

@keyframes runningBlink {
  from { opacity: 0.45; }
  to { opacity: 1; }
}

.main-panel {
  min-width: 0;
  min-height: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: auto;
  padding-bottom: calc(78px + var(--beian-footer-height));
}

.beian-footer {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 20;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: var(--beian-footer-height);
  border-top: 1px solid rgba(200, 210, 223, 0.72);
  background: rgba(248, 250, 252, 0.92);
  backdrop-filter: blur(10px);
  color: var(--muted);
  font-size: 12px;
}

.beian-footer a {
  color: var(--muted);
  text-decoration: none;
}

.beian-footer a:hover,
.beian-footer a:focus {
  color: var(--accent);
  text-decoration: underline;
}

.detail-header {
  position: sticky;
  top: 0;
  z-index: 4;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  position: relative;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  white-space: nowrap;
}

.status-badge.is-live {
  gap: 7px;
}

.status-badge.is-active-process {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.status-badge.is-live::before {
  display: inline-block;
  flex: 0 0 auto;
  position: relative;
  inset: auto;
  width: 7px;
  height: 7px;
  background: var(--warn);
  border: 0;
  border-radius: 999px;
  content: "";
  opacity: 1;
  animation: runningBlink 0.8s ease-in-out infinite alternate;
}

.status-running,
.status-waiting_user,
.status-queued {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.status-failed,
.status-killed {
  background: var(--danger-bg);
  border-color: #f4b8b2;
  color: var(--danger);
}

.conversation-layout {
  padding: 14px 16px 10px;
  min-height: 0;
  flex: 0 0 auto;
}

.timeline-panel,
.files-panel,
.composer,
.new-task {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.timeline-panel,
.live-process {
  min-height: 0;
  overflow: visible;
}

.timeline-panel {
  overflow: hidden;
}

.files-panel {
  margin: 0 16px 10px;
  flex: 0 0 auto;
  overflow: hidden;
}

.files-panel-title {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  list-style: none;
  cursor: pointer;
  gap: 10px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);
  padding: 10px 14px;
}

.files-panel-title::-webkit-details-marker {
  display: none;
}

.files-panel-title::before {
  content: "";
  width: 0;
  height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 6px solid var(--muted);
  transition: transform 120ms ease;
}

.files-panel[open] .files-panel-title {
  border-bottom: 1px solid var(--line);
}

.files-panel[open] .files-panel-title::before {
  transform: rotate(90deg);
}

.files-panel-body {
  display: grid;
}

.files-panel-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  padding: 8px 12px 0;
}

.files-panel-heading {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.files-upload-hint {
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  padding: 8px 12px;
}

.files-count,
.file-kind-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  line-height: 1;
  padding: 3px 7px;
  white-space: nowrap;
}

.files-list {
  display: grid;
  gap: 8px;
  padding: 10px 12px 12px;
}

.file-target {
  display: grid;
  gap: 7px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfe;
  padding: 10px;
}

.file-target.is-too-large {
  border-color: #e8c274;
  background: #fffaf0;
}

.result-file-links {
  display: grid;
  gap: 7px;
  margin-top: 10px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.result-file-links-title {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.result-file-links-list {
  display: grid;
  gap: 6px;
}

.result-file-link {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 6px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  padding: 7px;
}

.result-file-link-name {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-file-link-action {
  min-height: 30px;
  padding: 5px 8px;
}

.file-target-header {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.file-target-header strong {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-target-meta,
.file-target-source,
.file-target-status {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.file-target-status {
  min-height: 18px;
}

.file-target.is-too-large .file-target-status {
  color: var(--warn);
  font-weight: 700;
}

.file-target-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.live-process {
  border-top: 1px solid var(--line);
  background: #fbfcfe;
}

.live-process summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 600;
  padding: 10px 14px;
  user-select: none;
}

.live-process-footer {
  border-top: 1px solid var(--line);
  padding: 0;
}

.collapse-live-button {
  width: 100%;
  min-height: 30px;
  border: 0;
  border-radius: 0;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  padding: 0;
}

.collapse-live-button:hover:not(:disabled) {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: #8fcfc4;
}

.panel-title {
  position: sticky;
  top: 0;
  background: linear-gradient(180deg, #ffffff 0%, #fbfcfe 100%);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-weight: 600;
  padding: 10px 14px;
}

.focus-block {
  display: none;
}

.health-box {
  border-bottom: 1px solid var(--line);
  padding: 12px 14px;
}

.health-box:empty {
  display: none;
}

.history-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  margin: 10px 12px;
  padding: 12px 14px;
}

.history-user {
  background: #f7fbff;
  border-color: #cfe0f5;
}

.history-assistant {
  background: var(--panel);
  border-color: #d6e7e2;
}

.history-item summary {
  cursor: pointer;
  color: var(--blue);
  font-weight: 600;
  padding: 0;
}

details.history-item .body-text {
  padding-top: 8px;
}

.history-process {
  background: #fbfcfe;
  border-color: var(--line);
}

.message-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.message-header .label {
  flex: 1 1 auto;
  min-width: 0;
  margin-bottom: 0;
}

.message-time {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.body-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.body-text pre,
.rich-result pre {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: "Cascadia Mono", Consolas, monospace;
}

.body-text p,
.rich-result p {
  margin: 0 0 0.7em;
}

.body-text ul,
.body-text ol,
.rich-result ul,
.rich-result ol {
  margin: 0.4em 0 0.8em;
  padding-left: 1.4em;
}

.body-text code,
.rich-result code {
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 4px;
}

.body-text h1,
.body-text h2,
.body-text h3,
.body-text h4,
.rich-result h1,
.rich-result h2,
.rich-result h3,
.rich-result h4 {
  margin: 0.8em 0 0.4em;
}

.body-text table,
.rich-result table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.7em 0;
}

.body-text th,
.body-text td,
.rich-result th,
.rich-result td {
  border: 1px solid var(--line);
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
}

.body-text th,
.rich-result th {
  background: var(--surface-strong);
}

.body-text blockquote,
.rich-result blockquote {
  margin: 0.7em 0;
  border-left: 3px solid var(--line-strong);
  color: var(--muted);
  padding-left: 10px;
}

.event-list {
  display: grid;
  gap: 6px;
  padding: 0 12px 12px;
}

.process-projection {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.live-process .process-projection {
  margin: 0;
  padding: 10px 12px 12px;
}

.process-group {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  overflow: hidden;
}

.process-group.is-steer {
  border-color: #86b6ea;
  box-shadow: 0 0 0 2px rgba(40, 95, 159, 0.12);
}

.process-group.is-steer > .process-group-header {
  border-bottom-color: #b8d7f4;
  background: #eaf4ff;
}

.process-group.is-steer > .process-group-header strong {
  color: #123f6f;
}

.process-group-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
  padding: 7px 9px;
}

.process-group-header strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.process-assistant-text {
  border-bottom: 1px solid var(--line);
  padding: 9px 10px;
}

.process-steer-text {
  border-bottom: 1px solid var(--line);
  background: #f7fbff;
  padding: 9px 10px;
}

.process-assistant-text .markdown-body,
.process-steer-text .markdown-body,
.process-assistant-text pre {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.process-steer-text pre {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.process-steer-label {
  color: #123f6f;
  font-size: 12px;
  font-weight: 750;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.process-assistant-time,
.process-time {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.process-assistant-time {
  margin-bottom: 6px;
}

.process-tool-details {
  background: #fbfcfe;
}

.process-tool-details summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  padding: 8px 10px;
  user-select: none;
}

.process-tool-list {
  display: grid;
  gap: 4px;
  border-top: 1px solid var(--line);
  padding: 8px 10px 10px;
}

.process-tool-row {
  display: grid;
  grid-template-columns: minmax(70px, auto) auto minmax(0, 1fr);
  align-items: start;
  gap: 7px;
  min-height: 28px;
  border-left: 3px solid #a3adbd;
  padding: 4px 0 4px 8px;
}

.process-tool-kind {
  color: var(--muted);
  font-family: Consolas, "Cascadia Mono", monospace;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.process-tool-summary {
  min-width: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.process-status-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 20px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  line-height: 1;
  padding: 3px 7px;
  text-transform: uppercase;
  white-space: nowrap;
}

.process-group.process-status-running > .process-group-header .process-status-chip,
.process-status-chip.process-status-running {
  border-color: #e5b567;
  background: var(--warn-bg);
  color: var(--warn);
}

.process-group.process-status-completed > .process-group-header .process-status-chip,
.process-status-chip.process-status-completed {
  border-color: #9bd8bd;
  background: #e8f7ef;
  color: #16794c;
}

.process-group.process-status-failed > .process-group-header .process-status-chip,
.process-status-chip.process-status-failed {
  border-color: #f4b8b2;
  background: var(--danger-bg);
  color: var(--danger);
}

.process-tool-row.process-status-running {
  border-left-color: var(--warn);
}

.process-tool-row.process-status-completed {
  border-left-color: #16794c;
}

.process-tool-row.process-status-failed {
  border-left-color: var(--danger);
}

.composer {
  margin: 0 16px 16px;
  padding: 12px;
  flex: 0 0 auto;
  box-shadow: 0 -6px 22px rgba(20, 30, 48, 0.06);
}

.composer textarea {
  resize: vertical;
}

.upload-strip {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.upload-picker {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--muted);
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 700;
}

.upload-picker input {
  max-width: 170px;
  font-size: 12px;
}

.upload-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.upload-item {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  padding: 5px 8px;
  font-size: 12px;
}

.upload-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-status {
  flex: 0 0 auto;
  color: var(--muted);
}

.upload-remove {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 2px 0;
  font-size: 11px;
}

.upload-remove:hover {
  color: var(--danger);
}

.upload-item-materialized {
  border-color: #add7c5;
  background: #eefaf4;
}

.upload-item-failed,
.upload-item-expired {
  border-color: #f4b8b2;
  background: var(--danger-bg);
}

.composer-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.reply-execution-controls {
  display: flex;
  flex: 1 1 460px;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 8px;
  min-width: 280px;
  margin-left: auto;
}

.reply-execution-controls[hidden] {
  display: none;
}

.reply-execution-controls select {
  width: auto;
  min-width: 120px;
  padding: 7px 34px 7px 9px;
}

.reply-execution-controls .segmented-control {
  min-width: 132px;
}

.reply-execution-controls .execution-switch-summary,
.reply-execution-controls .status-line {
  align-self: center;
  flex: 0 1 220px;
  font-size: 12px;
  margin-top: 0;
  overflow-wrap: anywhere;
}

.composer-status {
  flex: 0 1 220px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.current-run-status {
  display: flex;
  flex: 1 1 280px;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  min-width: 260px;
  margin-left: auto;
}

.current-run-status:empty {
  display: none;
}

.current-run-status[hidden] {
  display: none;
}

.current-run-status-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  padding: 4px 8px;
  white-space: nowrap;
}

.current-run-status-item strong {
  color: var(--text);
}

.current-run-status-label {
  color: var(--muted);
}

.label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0;
  margin-bottom: 5px;
}

.markdown-body {
  white-space: normal;
  overflow-wrap: anywhere;
}

.markdown-body > :first-child {
  margin-top: 0;
}

.markdown-body > :last-child {
  margin-bottom: 0;
}

.markdown-body p,
.markdown-body ul,
.markdown-body ol,
.markdown-body blockquote,
.markdown-body pre,
.markdown-body table {
  margin: 8px 0;
}

.markdown-body ul,
.markdown-body ol {
  padding-left: 22px;
}

.markdown-body li + li {
  margin-top: 4px;
}

.markdown-body blockquote {
  border-left: 3px solid var(--line);
  color: var(--muted);
  padding-left: 10px;
}

.markdown-body pre {
  overflow: auto;
  background: #f6f8fb;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  white-space: pre;
}

.markdown-body code {
  background: #eef2f6;
  border-radius: 4px;
  font-family: Consolas, "Cascadia Mono", monospace;
  font-size: 12px;
  padding: 1px 4px;
}

.markdown-body pre code {
  background: transparent;
  border-radius: 0;
  padding: 0;
}

.markdown-body table {
  border-collapse: collapse;
  display: block;
  max-width: 100%;
  overflow: auto;
  width: max-content;
}

.markdown-body th,
.markdown-body td {
  border: 1px solid var(--line);
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
}

.markdown-body th {
  background: #f3f5f7;
  font-weight: 600;
}

.markdown-body img {
  height: auto;
  max-width: 100%;
}

.markdown-body .katex-display {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}

.markdown-body .katex-display > .katex {
  min-width: max-content;
}

.question-box {
  margin-top: 10px;
}

.question-card {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  background: #fbfcfd;
  margin-top: 8px;
}

.question-card.is-disabled {
  background: #f8fafc;
}

.question-state-note {
  color: var(--muted);
  font-size: 12px;
  margin-top: 8px;
}

.question-card label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin-top: 8px;
}

.question-answer-control {
  display: grid;
  gap: 8px;
  margin-top: 6px;
}

.question-answer-control input[hidden] {
  display: none;
}

.execution-switch {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfd;
  margin-bottom: 10px;
}

.execution-switch summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  list-style-position: inside;
  padding: 9px 10px;
}

.execution-switch-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 0 10px 10px;
}

.execution-switch-grid > .segmented-control {
  grid-column: 1 / -1;
}

.execution-switch-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px 10px;
}

.execution-selectors {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

.execution-selectors label:last-child {
  grid-column: 1 / -1;
}

.segmented-control {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.segmented-control[hidden] {
  display: none !important;
}

.segmented-control button {
  min-width: 86px;
  padding: 8px 12px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.segmented-control button:last-child {
  border-right: 0;
}

.segmented-control button.is-selected {
  background: #0f766e;
  color: #fff;
}

.new-task {
  min-height: 100vh;
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
}

.new-task-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: -16px -16px 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  position: sticky;
  top: 0;
  z-index: 2;
}

.new-task label {
  margin-top: 12px;
}

.create-task-button {
  width: 100%;
  margin-top: 14px;
}

.empty-list {
  color: var(--muted);
  padding: 16px 12px;
}

.session-list::-webkit-scrollbar,
.main-panel::-webkit-scrollbar,
.right-panel::-webkit-scrollbar {
  width: 10px;
}

.session-list::-webkit-scrollbar-thumb,
.main-panel::-webkit-scrollbar-thumb,
.right-panel::-webkit-scrollbar-thumb {
  background: #cbd5df;
  border: 3px solid transparent;
  border-radius: 999px;
  background-clip: content-box;
}

@media (max-width: 1100px) {
  .app-shell,
  .app-shell.is-new-task-open {
    grid-template-columns: 280px minmax(0, 1fr);
    overflow: auto;
  }

  .right-panel {
    grid-column: 1 / -1;
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 780px) {
  body {
    overflow: hidden;
  }

  .app-shell {
    display: block;
    height: 100vh;
    overflow: hidden;
  }

  .sidebar,
  .main-panel,
  .right-panel {
    height: 100vh;
    overflow: auto;
  }

  .app-shell.mobile-view-sessions:not(.is-new-task-open) .main-panel,
  .app-shell.mobile-view-detail:not(.is-new-task-open) .sidebar,
  .app-shell.is-new-task-open .sidebar,
  .app-shell.is-new-task-open .main-panel {
    display: none;
  }

  .app-shell.mobile-view-sessions:not(.is-new-task-open) .sidebar {
    display: flex;
  }

  .app-shell.is-new-task-open .right-panel {
    display: block;
  }

  .app-shell:not(.is-new-task-open) .right-panel {
    display: none;
  }

  .detail-header {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .detail-heading {
    flex: 1 1 min(100%, 220px);
  }

  .header-actions {
    flex: 0 0 auto;
  }

  .mobile-detail-nav {
    width: 100%;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #f7fafc;
    padding: 8px;
  }

  .mobile-back-button {
    min-width: 88px;
    border-color: var(--line-strong);
    background: #ffffff;
    color: var(--accent-strong);
    font-weight: 750;
  }

  .mobile-session-switcher {
    min-height: 38px;
    border-color: #b7d7d1;
    background-color: #ffffff;
    color: var(--text);
  }

  .mobile-session-search {
    grid-column: 1 / -1;
    min-height: 36px;
    background-color: #ffffff;
  }

  #workspace-select {
    min-height: 38px;
    border-color: #b7d7d1;
  }

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

  .message-time {
    white-space: normal;
  }

  .current-run-status {
    justify-content: flex-start;
    min-width: 0;
    width: 100%;
  }

  .files-panel {
    margin: 0 10px 10px;
  }

  .files-panel-title {
    align-items: center;
    grid-template-columns: auto minmax(0, 1fr) auto;
    padding: 10px 12px;
  }

  .files-panel-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .file-target {
    padding: 9px;
  }

  .file-target-actions > button {
    flex: 1 1 130px;
    min-width: 0;
  }

  .upload-picker {
    width: 100%;
  }

  .upload-picker input {
    min-width: 0;
    max-width: 100%;
  }

  .upload-item {
    width: 100%;
  }

  .execution-switch-grid {
    grid-template-columns: 1fr;
  }

  .execution-selectors {
    grid-template-columns: 1fr;
  }

  .execution-selectors label:last-child {
    grid-column: auto;
  }
}
