:root {
  color-scheme: light;
  --page: #f6f7f9;
  --panel: #ffffff;
  --panel-soft: #fafbfc;
  --border: #e6e8ec;
  --border-strong: #d8dce3;
  --text: #25282d;
  --muted: #7b818b;
  --muted-light: #a3a8b1;
  --accent: #5068e8;
  --accent-soft: #eef1ff;
  --purple: #8d6bd8;
  --success: #2f9d6a;
  --success-soft: #eef9f3;
  --danger: #c94b45;
  --danger-soft: #fff2f1;
  --shadow: 0 14px 36px rgba(28, 34, 45, 0.08);
  --radius: 16px;
  font-family: Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--page);
  overflow: hidden;
}

button,
input,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

.shell {
  display: grid;
  grid-template-columns: 56px 236px minmax(0, 1fr) 260px;
  height: 100vh;
  background: var(--panel);
}

.rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  padding: 12px 6px;
  background: #f8f9fb;
  border-right: 1px solid var(--border);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin: 0 0 11px;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(145deg, #6579ed, #8e6bd8);
  box-shadow: 0 8px 18px rgba(80, 104, 232, 0.22);
  font-weight: 750;
}

.rail-item {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: #969ca6;
  font-size: 18px;
  cursor: default;
}

.rail-item.active {
  color: var(--accent);
  background: var(--accent-soft);
}

.rail-item.muted {
  font-size: 12px;
  font-weight: 700;
}

.rail-spacer {
  flex: 1;
}

.sidebar {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-right: 1px solid var(--border);
}

.sidebar-head {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px 16px 12px;
}

.sidebar-head h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
}

.btn-new {
  height: 38px;
  border: 0;
  border-radius: 10px;
  color: #fff;
  background: var(--accent);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(80, 104, 232, 0.18);
}

.btn-new:disabled,
.btn-primary:disabled,
.btn-secondary:disabled,
.btn-ghost:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  box-shadow: none;
}

.conversation-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  list-style: none;
  margin: 0;
  padding: 4px 9px 18px;
}

.conversation-list li {
  margin: 0 0 4px;
}

.conversation-row {
  position: relative;
}

.conversation-item {
  width: 100%;
  padding: 10px 11px;
  border: 0;
  border-radius: 10px;
  color: var(--text);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.conversation-row:hover .conversation-item,
.conversation-item.active {
  background: #f3f5f8;
}

.conversation-item.active {
  box-shadow: inset 2px 0 var(--accent);
}

.conversation-item .title,
.conversation-item .preview {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-item .title {
  font-size: 13px;
  font-weight: 600;
  padding-right: 72px;
}

.conversation-item .preview {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  padding-right: 72px;
}

.conversation-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: none;
  gap: 4px;
  z-index: 1;
}

.conversation-row:hover .conversation-actions,
.conversation-row:focus-within .conversation-actions {
  display: flex;
}

.conversation-action {
  padding: 2px 6px;
  border: 0;
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
  cursor: pointer;
  box-shadow: 0 0 0 1px #e5e7eb;
}

.conversation-action:hover {
  color: var(--text);
  background: #f8fafc;
}

.conversation-action.danger:hover {
  color: #b91c1c;
  background: #fef2f2;
}

.conversation-rename-input {
  display: block;
  width: calc(100% - 8px);
  margin: 0;
  padding: 2px 6px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  background: #fff;
  outline: none;
}

.workspace {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--panel);
}

.workspace-head {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.94);
}

.workspace-kicker {
  margin: 0 0 1px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.workspace-head h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 650;
}

.sub {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.workspace-actions {
  display: flex;
  flex-shrink: 0;
  gap: 8px;
}

.btn-ghost,
.btn-primary,
.btn-secondary {
  min-height: 36px;
  border-radius: 9px;
  padding: 0 14px;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.btn-ghost,
.btn-secondary {
  border: 1px solid var(--border-strong);
  background: var(--panel);
}

.btn-ghost:hover,
.btn-secondary:hover {
  background: #f7f8fa;
}

.btn-primary {
  border: 1px solid var(--accent);
  color: #fff;
  background: var(--accent);
  font-weight: 600;
}

.btn-primary:not(:disabled):hover {
  background: #4159dc;
}

.config-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 11px;
  padding: 15px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-soft);
}

.config-panel label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  color: var(--muted);
  font-size: 11px;
}

.config-panel label.wide {
  grid-column: 1 / -1;
}

.config-panel input {
  width: 100%;
  height: 35px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 0 10px;
  color: var(--text);
  background: #fff;
  outline: none;
}

.config-panel input:focus,
.field-input:focus,
.home-composer textarea:focus,
.composer textarea:focus {
  border-color: #9cabf3;
  box-shadow: 0 0 0 3px rgba(80, 104, 232, 0.1);
}

.error {
  margin: 10px 24px 0;
  padding: 10px 12px;
  border: 1px solid #f0c9c6;
  border-radius: 9px;
  color: var(--danger);
  background: var(--danger-soft);
  font-size: 12px;
}

.home-view {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 40px 28px 56px;
  overflow-y: auto;
  background:
    radial-gradient(circle at 50% 10%, rgba(80, 104, 232, 0.08), transparent 34%),
    linear-gradient(180deg, #fbfbfc 0%, #f6f7f9 100%);
}

.home-hero {
  max-width: 620px;
  text-align: center;
}

.hero-avatar {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin: 0 auto 14px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid #e8ebf0;
  background: #fff;
  box-shadow: 0 12px 26px rgba(50, 96, 200, 0.14);
}

.home-hero h3 {
  margin: 0;
  font-size: clamp(24px, 2.5vw, 32px);
  font-weight: 680;
  letter-spacing: -0.035em;
}

.home-hero p {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.home-composer {
  width: min(720px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
  padding: 10px 10px 10px 14px;
  border: 1px solid var(--border);
  border-radius: 19px;
  background: #fff;
  box-shadow: var(--shadow);
}

.home-composer textarea,
.composer textarea {
  width: 100%;
  resize: none;
  border: 0;
  outline: none;
  color: var(--text);
  background: transparent;
  line-height: 1.55;
}

.home-composer textarea {
  min-height: 64px;
  padding: 8px 4px;
}

.btn-send {
  width: 42px;
  min-width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 12px;
  font-size: 21px;
  line-height: 1;
}

.prompt-cards {
  width: min(820px, 100%);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.prompt-card {
  min-height: 74px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 5px;
  padding: 13px 15px;
  border: 1px solid var(--border);
  border-radius: 13px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.9);
  text-align: left;
  cursor: pointer;
}

.prompt-card:hover {
  border-color: #cbd2f7;
  background: #fff;
  box-shadow: 0 8px 22px rgba(28, 34, 45, 0.06);
  transform: translateY(-1px);
}

.prompt-card strong {
  font-size: 13px;
}

.prompt-card span,
.home-tags span {
  color: var(--muted);
  font-size: 11px;
}

.home-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
}

.home-tags span {
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
}

.chat-view {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  background: #fff;
}

.messages {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 28px;
  overflow-y: auto;
  padding: 34px clamp(24px, 4vw, 58px) 36px;
  scroll-behavior: smooth;
}

.user-message-row,
.task-run {
  width: min(900px, 100%);
  margin-inline: auto;
}

.user-message-row {
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
  gap: 10px;
}

.user-message {
  max-width: min(650px, 78%);
  padding: 12px 16px;
  border-radius: 16px 4px 16px 16px;
  color: #30343a;
  background: #f2f3f5;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.avatar {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 700;
}

.avatar-user {
  color: #fff;
  background: linear-gradient(145deg, #916fdd, #b288eb);
}

.avatar-assistant {
  overflow: hidden;
  border: 1px solid #e8ebf0;
  background: #fff;
}

.avatar-assistant img,
.hero-avatar img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transform: scale(1.16);
}

.task-run {
  position: relative;
}

.task-run-header {
  display: flex;
  align-items: center;
  gap: 14px;
}

.task-run-heading {
  flex: 1;
  min-width: 0;
}

.task-run-status-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
}

.task-run-status {
  color: #5f646d;
  font-size: 15px;
  font-weight: 600;
}

.task-run[data-status="failed"] .task-run-status {
  color: var(--danger);
}

.task-run[data-status="completed"] .task-run-status {
  color: #555b64;
}

.task-run-elapsed {
  color: var(--muted);
  font-size: 14px;
}

.task-run-chevron {
  color: var(--muted-light);
  font-size: 18px;
}

.task-run-content {
  margin: 18px 0 0 50px;
  color: #30343a;
}

.task-run-text {
  font-size: 15px;
  line-height: 1.72;
  white-space: pre-wrap;
  word-break: break-word;
}

.task-run-text:empty {
  display: none;
}

.task-plan-panel {
  margin: 0 0 12px;
  max-width: 520px;
  border: 1px solid #e8ebf0;
  border-radius: 10px;
  background: #fafbfc;
  color: #4b5563;
}

.task-plan-panel[hidden] {
  display: none;
}

.task-plan-summary {
  cursor: pointer;
  list-style: none;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 600;
  color: #374151;
}

.task-plan-summary::-webkit-details-marker {
  display: none;
}

.task-plan-list {
  margin: 0;
  padding: 0 12px 10px;
  list-style: none;
  display: grid;
  gap: 6px;
}

.task-plan-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 8px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #eef1f5;
  font-size: 13px;
}

.task-plan-domain {
  color: #30343a;
  font-weight: 500;
}

.task-plan-status {
  color: var(--muted);
}

.task-plan-item[data-status="succeeded"] .task-plan-status {
  color: #2f6f4e;
}

.task-plan-item[data-status="failed"] .task-plan-status {
  color: var(--danger);
}

.task-plan-item[data-status="waiting_input"] .task-plan-status,
.task-plan-item[data-status="waiting_confirmation"] .task-plan-status {
  color: #9a6700;
}

.tool-trace {
  margin: 0 0 12px;
  max-width: 520px;
  border: 1px solid #e8ebf0;
  border-radius: 10px;
  background: #fafbfc;
  color: #4b5563;
}

.tool-trace[hidden] {
  display: none;
}

.tool-trace-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  list-style: none;
  cursor: pointer;
  user-select: none;
  font-size: 13px;
  line-height: 1.4;
}

.tool-trace-summary::-webkit-details-marker {
  display: none;
}

.tool-trace-icon {
  color: #6b7fd7;
  font-size: 12px;
}

.tool-trace-label {
  flex: 1;
  min-width: 0;
  font-weight: 500;
  color: #374151;
}

.tool-trace-chevron {
  color: #9aa3b2;
  font-size: 11px;
  transition: transform 0.15s ease;
}

.tool-trace[open] .tool-trace-chevron {
  transform: rotate(180deg);
}

.tool-trace-list {
  list-style: none;
  margin: 0;
  padding: 0 12px 10px;
  border-top: 1px solid #eef1f5;
}

.tool-trace-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "dot name toggle"
    ". meta meta"
    "detail detail detail";
  column-gap: 8px;
  row-gap: 2px;
  padding: 8px 0;
  border-bottom: 1px solid #f1f3f7;
  font-size: 12px;
  align-items: center;
}

.tool-trace-item:last-child {
  border-bottom: none;
}

.tool-trace-dot {
  grid-area: dot;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #9aa3b2;
}

.tool-trace-dot.ok {
  background: #2f9b63;
}

.tool-trace-dot.error {
  background: #c24141;
}

.tool-trace-dot.running {
  background: #6b7fd7;
}

.tool-trace-name {
  grid-area: name;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-weight: 600;
  color: #1f2937;
}

.tool-trace-meta {
  grid-area: meta;
  color: #8b93a7;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tool-trace-detail-toggle {
  grid-area: toggle;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #6b7fd7;
  font: inherit;
  font-size: 11px;
  cursor: pointer;
  white-space: nowrap;
}

.tool-trace-detail-toggle:hover {
  text-decoration: underline;
}

.tool-trace-detail {
  grid-area: detail;
  margin: 4px 0 0;
  padding: 8px;
  overflow: auto;
  max-height: 160px;
  border-radius: 6px;
  background: #fff;
  border: 1px solid #eef1f5;
  color: #64748b;
  font-size: 11px;
  line-height: 1.45;
}

.thinking-line {
  display: flex;
  align-items: center;
  gap: 5px;
  min-height: 30px;
  color: var(--muted);
}

.thinking-line span {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #aeb4bf;
  animation: thinking 1.15s infinite ease-in-out;
}

.thinking-line span:nth-child(2) {
  animation-delay: 0.15s;
}

.thinking-line span:nth-child(3) {
  animation-delay: 0.3s;
}

.thinking-line em {
  margin-left: 5px;
  font-style: normal;
  font-size: 13px;
}

@keyframes thinking {
  0%, 60%, 100% { opacity: 0.35; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-2px); }
}

.task-run-footer {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 13px 0 0 50px;
  color: var(--muted-light);
  font-size: 12px;
}

.task-action,
.rating-star {
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  color: var(--muted-light);
  background: transparent;
  cursor: pointer;
}

.task-action {
  width: 24px;
  height: 24px;
  font-size: 17px;
}

.task-time {
  font-variant-numeric: tabular-nums;
}

.task-divider {
  width: 1px;
  height: 16px;
  background: var(--border);
}

.task-rating {
  display: inline-flex;
  gap: 1px;
}

.rating-star {
  width: 20px;
  height: 22px;
  font-size: 20px;
}

.rating-star[aria-pressed="true"] {
  color: #e5a72f;
}

.supplement-card {
  margin-top: 17px;
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  background: #fff;
  overflow: hidden;
}

.supplement-card-header {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 16px;
}

.supplement-card-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #3d424a;
  font-size: 15px;
  font-weight: 620;
}

.supplement-card-title > span {
  color: #676d77;
  font-size: 20px;
}

.supplement-card-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.submitted-badge {
  color: var(--success);
  font-size: 12px;
}

.card-toggle {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 17px;
}

.supplement-card-body {
  display: flex;
  flex-direction: column;
  gap: 15px;
  padding: 4px 16px 18px;
  border-top: 1px solid #f0f1f3;
}

.card-intro {
  margin: 13px 0 0;
  color: #686e78;
  font-size: 14px;
  line-height: 1.6;
}

.choice-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.choice-grid.compact {
  gap: 8px;
}

.choice-pill {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 13px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: #3d4249;
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.choice-pill:hover,
.choice-pill.is-selected,
.radio-pill:has(input:checked) {
  border-color: #a9b4ef;
  background: var(--accent-soft);
}

.choice-pill-stacked {
  align-items: flex-start;
  border-radius: 13px;
}

.choice-pill-stacked > span:last-child {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.choice-pill strong {
  font-size: 13px;
  font-weight: 600;
}

.choice-pill small {
  color: var(--muted);
  font-size: 11px;
}

.choice-dot {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  border: 1px solid #cdd1d8;
  border-radius: 50%;
  background: #fff;
  box-shadow: inset 0 0 0 4px #fff;
}

.choice-pill.is-selected .choice-dot,
.radio-pill:has(input:checked) .choice-dot {
  border-color: var(--accent);
  background: var(--accent);
}

.radio-pill {
  position: relative;
}

.radio-pill input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.supplement-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-field {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.form-field legend {
  margin: 0 0 9px;
  color: #5f6570;
  font-size: 13px;
}

.form-field legend span {
  color: #db6b5a;
}

.field-input {
  width: 100%;
  min-height: 58px;
  resize: vertical;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  color: var(--text);
  background: #fff;
  outline: none;
  line-height: 1.5;
}

.field-input-single,
.field-select {
  min-height: 42px;
  resize: none;
}

.field-input-wrap {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.field-input-wrap .field-input-single {
  flex: 1;
}

.field-unit {
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  color: #7a8088;
  background: #f7f8fa;
  white-space: nowrap;
}

.field-input:disabled,
.field-select:disabled,
.supplement-card.is-submitted .choice-pill {
  color: #535963;
  background: #fafafa;
  opacity: 1;
}

.card-actions {
  display: flex;
  gap: 9px;
  margin-top: 2px;
}

.card-actions .btn-primary,
.card-actions .btn-secondary {
  min-width: 92px;
}

.card-hint {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.approval-process {
  margin-top: 4px;
  padding: 12px 14px;
  border: 1px solid #eef0f3;
  border-radius: 12px;
  background: #fafbfc;
}

.approval-process-title {
  margin: 0 0 12px;
  color: #3d424a;
  font-size: 14px;
  font-weight: 620;
}

.approval-process-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0;
}

.approval-process-step {
  position: relative;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding-bottom: 18px;
}

.approval-process-step:last-child {
  padding-bottom: 0;
}

.approval-process-step.has-next::after {
  content: "";
  position: absolute;
  left: 13px;
  top: 28px;
  bottom: 0;
  border-left: 2px dashed #d5d9e0;
}

.approval-process-marker {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid #d5d9e0;
  background: #fff;
  position: relative;
  z-index: 1;
}

.approval-process-step--submit .approval-process-marker {
  border-color: #7fd4c8;
  background: #e8f8f5;
}

.approval-process-step--approve .approval-process-marker {
  border-color: #4b6fd6;
  background: #edf2ff;
}

.approval-process-step--end .approval-process-marker {
  border-color: #d5d9e0;
  background: #f3f4f6;
}

.approval-process-body {
  min-width: 0;
  padding-top: 3px;
}

.approval-process-step-title {
  color: #353a42;
  font-size: 14px;
  font-weight: 600;
}

.approval-process-step-meta {
  margin-top: 4px;
  color: #7a808a;
  font-size: 12px;
}

.approval-process-picker {
  margin-top: 6px;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid #4b6fd6;
  border-radius: 8px;
  color: #4b6fd6;
  background: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: not-allowed;
  opacity: 0.72;
}

.preview-list {
  display: grid;
  grid-template-columns: minmax(90px, 0.25fr) minmax(0, 1fr);
  gap: 10px 16px;
  margin: 0;
  padding: 3px 0;
}

.preview-list dt {
  color: var(--muted);
  font-size: 12px;
}

.preview-list dd {
  margin: 0;
  color: #353a42;
  font-size: 13px;
  font-weight: 550;
  white-space: pre-wrap;
  word-break: break-word;
}

.preview-summary {
  margin: 0;
  padding: 12px;
  border-left: 3px solid #cfd4dd;
  border-radius: 4px 9px 9px 4px;
  color: #626872;
  background: #f8f9fa;
  font-family: inherit;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
}

.confirmation-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.confirmation-list li {
  position: relative;
  padding: 9px 12px 9px 28px;
  border-radius: 9px;
  background: #f7f8fa;
  font-size: 13px;
}

.confirmation-list li::before {
  content: "✓";
  position: absolute;
  left: 11px;
  color: var(--success);
}

.composer {
  padding: 12px clamp(24px, 4vw, 58px) 18px;
  border-top: 1px solid rgba(230, 232, 236, 0.86);
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
}

.composer-row {
  width: min(900px, 100%);
  min-height: 58px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
  margin-inline: auto;
  padding: 8px 9px 8px 15px;
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(28, 34, 45, 0.06);
}

.composer textarea {
  min-height: 40px;
  max-height: 130px;
  padding: 8px 1px;
}

.pipeline-panel {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
  background: #fafbfc;
}

.pipeline-head {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 13px;
  border-bottom: 1px solid var(--border);
  background: #fff;
}

.pipeline-head > div {
  display: flex;
  align-items: center;
  gap: 7px;
}

.pipeline-head h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 650;
}

.pipeline-head span {
  padding: 2px 6px;
  border-radius: 999px;
  color: var(--success);
  background: var(--success-soft);
  font-size: 9px;
}

.pipeline-head .btn-ghost {
  min-height: 30px;
  padding: 0 9px;
  color: var(--muted);
  font-size: 11px;
}

.pipeline-empty {
  margin: 18px 14px;
  color: var(--muted-light);
  font-size: 11px;
  line-height: 1.55;
}

.pipeline-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  list-style: none;
  margin: 0;
  padding: 10px 9px 24px;
}

.pipeline-request {
  margin: 0 0 10px;
  padding-left: 8px;
  border-left: 2px solid var(--border);
}

.pipeline-request-summary {
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  color: #4b5563;
  list-style: none;
}

.pipeline-request-summary::-webkit-details-marker {
  display: none;
}

.pipeline-request-steps {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
}

.pipeline-item {
  margin: 0 0 7px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
}

.pipeline-item summary {
  display: grid;
  gap: 4px;
  padding: 9px 10px;
  list-style: none;
  cursor: pointer;
}

.pipeline-item summary::-webkit-details-marker {
  display: none;
}

.pipeline-item .step {
  overflow: hidden;
  color: #6474c7;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pipeline-item .summary {
  color: #59606b;
  font-size: 11px;
  line-height: 1.45;
}

.pipeline-item .status {
  justify-self: start;
  padding: 1px 6px;
  border-radius: 999px;
  color: var(--muted);
  background: #f1f2f4;
  font-size: 9px;
}

.pipeline-item .status.ok {
  color: var(--success);
  background: var(--success-soft);
}

.pipeline-item .status.error {
  color: var(--danger);
  background: var(--danger-soft);
}

.pipeline-item .status.skipped {
  color: #a87818;
  background: #fff8e7;
}

.pipeline-item pre {
  margin: 0;
  padding: 0 10px 10px;
  color: #69707b;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 9px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

@media (max-width: 1180px) {
  .shell {
    grid-template-columns: 56px 220px minmax(0, 1fr);
  }

  .pipeline-panel {
    display: none;
  }
}

@media (max-width: 880px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .rail,
  .sidebar,
  .pipeline-panel {
    display: none;
  }

  .workspace-head {
    padding-inline: 18px;
  }

  .messages,
  .composer {
    padding-inline: 18px;
  }

  .config-panel {
    grid-template-columns: 1fr;
  }

  .config-panel label.wide {
    grid-column: auto;
  }
}

@media (max-width: 620px) {
  .workspace-head {
    min-height: 64px;
  }

  .workspace-head .sub,
  .workspace-actions #clearContext {
    display: none;
  }

  .home-view {
    justify-content: flex-start;
    padding: 54px 16px 36px;
  }

  .prompt-cards {
    grid-template-columns: 1fr;
  }

  .messages {
    gap: 22px;
    padding: 24px 14px;
  }

  .composer {
    padding: 10px 12px 12px;
  }

  .user-message {
    max-width: 84%;
  }

  .task-run-content,
  .task-run-footer {
    margin-left: 0;
  }

  .supplement-card-body {
    padding-inline: 13px;
  }

  .choice-grid {
    flex-direction: column;
  }

  .choice-pill {
    width: 100%;
  }

  .preview-list {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .preview-list dd {
    margin-bottom: 8px;
  }
}

.message-sources {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border, #e5e7eb);
  font-size: 0.85rem;
}

.message-sources h4 {
  margin: 0 0 0.35rem;
  font-weight: 600;
}

.message-sources ol {
  margin: 0;
  padding-left: 1.1rem;
}

.message-sources a {
  color: inherit;
  text-decoration: underline;
}
