:root {
  color-scheme: light;
  --canvas: #f5f6f8;
  --surface: #ffffff;
  --surface-soft: #f7f8fa;
  --surface-blue: #f2f6ff;
  --line: #e3e6eb;
  --line-strong: #cfd5df;
  --text: #20242b;
  --text-soft: #66707d;
  --text-faint: #98a0ab;
  --blue: #4d6bfe;
  --blue-soft: #eef3ff;
  --orange: #e68a00;
  --orange-soft: #fff7e8;
  --green: #16a35a;
  --green-soft: #ecf9f1;
  --red: #d94b50;
  --red-soft: #fff0f1;
  --shadow: 0 18px 48px rgba(30, 38, 52, 0.12), 0 2px 10px rgba(30, 38, 52, 0.05);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-width: 320px; min-height: 100%; background: var(--canvas); color: var(--text); }
body { min-height: 100svh; }
button, input, textarea, select { font: inherit; letter-spacing: 0; }
button { color: inherit; }
.hidden { display: none !important; }
.desktop-only { display: none !important; }

#floating-surface { display: none; }
html.floating-surface,
body.floating-surface { height: 100%; min-height: 100%; min-width: 0; background: transparent; }
body.floating-surface { min-width: 0; overflow: hidden; }
body.floating-surface .activity-workspace {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  background: transparent;
}
body.floating-surface .activity-workspace > :not(#floating-surface) { display: none !important; }
body.floating-surface #floating-surface {
  display: flex;
  width: 100%;
  height: 100%;
  align-items: flex-start;
  padding: 0;
  background: transparent;
}

.capsule {
  width: 100%;
  display: flex;
  flex-direction: column;
  border: 0;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 10px 26px rgba(30, 38, 52, 0.14), 0 1px 4px rgba(30, 38, 52, 0.06);
  overflow: hidden;
}
.cap-head { display: flex; align-items: center; gap: 9px; height: 46px; padding: 0 12px; }
.floating-mark {
  width: 26px;
  height: 26px;
  display: inline-grid;
  flex: none;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: #242a32;
  box-shadow: 0 3px 7px rgba(36, 42, 50, 0.28);
}
.floating-mark svg { width: 14px; height: 14px; }
.cap-title { display: inline-flex; align-items: center; gap: 6px; padding: 2px; border: 0; background: transparent; color: var(--text); cursor: pointer; font-size: 12.5px; font-weight: 750; white-space: nowrap; }
.floating-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.cap-metrics { display: inline-flex; align-items: center; gap: 10px; margin-left: auto; }
.floating-metric { display: inline-flex; align-items: baseline; gap: 5px; }
.floating-metric b {
  font-size: 16px;
  line-height: 19px;
  font-weight: 760;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.floating-metric > span { color: var(--text-faint); font-size: 10px; white-space: nowrap; }
.floating-primary b { color: var(--blue); }
.floating-secondary b { color: var(--orange); }
.floating-state { display: none; }

.cap-body { display: none; }
body.floating-expanded .cap-body { display: block; }
.cap-tasks { display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.cap-task { display: flex; align-items: center; gap: 7px; width: 100%; padding: 7px 12px; border: 0; background: transparent; cursor: pointer; text-align: left; }
.cap-task + .cap-task { border-top: 1px solid var(--line); }
.cap-task:hover { background: var(--surface-soft); }
.cap-task .dot { width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--text-faint); }
.cap-task .dot.running { background: var(--blue); }
.cap-task .dot.waiting { background: var(--orange); }
.cap-task .dot.completed { background: var(--green); }
.cap-task .dot.failed { background: var(--red); }
.cap-task .dot.unmatched { background: var(--text-faint); }
.cap-task span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-soft); font-size: 11px; }
.cap-task small { margin-left: auto; color: var(--text-faint); font-size: 9.5px; }
.cap-empty { padding: 10px 12px; color: var(--text-faint); font-size: 10.5px; text-align: center; }
.cap-foot { display: flex; gap: 6px; padding: 8px 12px 10px; border-top: 1px solid var(--line); }
.cap-btn {
  flex: 1;
  height: 26px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-soft);
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
}
.cap-btn:hover { background: var(--surface-soft); color: var(--text); }
.cap-btn.primary { border-color: transparent; background: linear-gradient(145deg, #6280ff, #4d6bfe); color: #fff; }

body.session-surface { min-width: 680px; background: var(--canvas); }
body.session-surface .activity-workspace { display: block; min-height: 100svh; padding: 0; }
body.session-surface .activity-workspace > .monitor-panel,
body.session-surface .activity-workspace > #floating-surface { display: none !important; }
body.session-surface #dsh-panel {
  display: flex;
  width: 100%;
  height: 100svh;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
body.session-surface .dsh-header { padding-left: 84px; }

.activity-workspace {
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(420px, 520px) minmax(440px, 720px);
  justify-content: center;
  align-items: stretch;
  gap: 18px;
  padding: 24px;
}

.monitor-panel,
.task-drawer {
  min-width: 0;
  height: calc(100svh - 48px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.monitor-panel { display: flex; flex-direction: column; }
.panel-header {
  min-height: 54px;
  display: flex;
  flex: 0 0 54px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 12px 0 16px;
  border-bottom: 1px solid var(--line);
}
.panel-title,
.panel-actions,
.connection-state,
.section-heading > span,
.section-toggle > span,
.work-state,
.drawer-actions {
  display: inline-flex;
  align-items: center;
}

.panel-title { min-width: 0; gap: 8px; font-size: 14px; }
.panel-title > strong { flex: none; }
.panel-logo {
  width: 25px;
  height: 25px;
  display: inline-grid;
  flex: none;
  place-items: center;
  border-radius: 6px;
  color: white;
  background: #242a32;
}
.panel-logo svg { width: 15px; height: 15px; }
.connection-dot {
  width: 7px;
  height: 7px;
  flex: none;
  border-radius: 50%;
  background: var(--text-faint);
}
.connection-state.connected .connection-dot { background: var(--green); }

.panel-actions { flex: none; gap: 3px; }
.connection-state {
  flex: none;
}
.connection-state.error .connection-dot { background: var(--text-faint); }
.icon-button {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}
.icon-button:hover { background: var(--surface-soft); }
.icon-button:focus-visible,
.section-toggle:focus-visible,
.session-row:focus-visible,
.source-summary:focus-visible,
.drawer-tab:focus-visible,
.command-button:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
.icon-button:disabled { opacity: 0.45; cursor: default; }
.icon-button svg { width: 16px; height: 16px; }
.pin-toggle-active { color: var(--blue); background: var(--blue-soft); }

.create-task-dialog {
  width: min(390px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.create-task-dialog::backdrop { background: rgba(32, 36, 43, 0.22); backdrop-filter: blur(2px); }
.create-task-form { display: flex; flex-direction: column; gap: 12px; padding: 14px; }
.create-task-form header,
.create-task-form footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.create-task-form header strong { font-size: 12px; }
.create-task-form footer { justify-content: flex-end; }
.create-task-form textarea {
  width: 100%;
  min-height: 108px;
  resize: vertical;
  padding: 9px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  outline: none;
  color: var(--text);
  font-size: 11px;
  line-height: 17px;
}
.create-task-form textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(77, 107, 254, 0.1); }

.panel-scroll {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  flex-direction: column;
  overflow: auto;
  scrollbar-color: rgba(117, 126, 140, 0.42) transparent;
  scrollbar-width: thin;
}
.panel-scroll::-webkit-scrollbar { width: 7px; height: 7px; }
.panel-scroll::-webkit-scrollbar-track { background: transparent; }
.panel-scroll::-webkit-scrollbar-thumb {
  border: 1px solid transparent;
  border-radius: 7px;
  background: rgba(117, 126, 140, 0.38);
  background-clip: padding-box;
}
.panel-scroll::-webkit-scrollbar-thumb:hover { background: rgba(91, 101, 116, 0.62); background-clip: padding-box; }
.panel-scroll::-webkit-scrollbar-corner { background: transparent; }
.activity-section { display: flex; flex: 0 0 auto; flex-direction: column; gap: 12px; padding: 14px 16px 0; }
.activity-heading { display: flex; min-width: 0; flex-direction: column; align-items: stretch; gap: 5px; }
.activity-heading h1 {
  min-width: 0;
  margin: 0;
  font-size: 13px;
  line-height: 18px;
  overflow-wrap: anywhere;
}
.activity-stats { display: flex; justify-content: space-between; gap: 9px; color: var(--text-faint); font-size: 9.5px; white-space: nowrap; }
.activity-stats b { color: inherit; font-weight: 500; font-variant-numeric: tabular-nums; }

.search-row { position: relative; display: grid; grid-template-columns: 1fr 110px; gap: 7px; }
.search-row > svg { position: absolute; top: 9px; left: 9px; width: 14px; height: 14px; color: var(--text-faint); }
.search-row input,
.search-row select {
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  outline: none;
  color: var(--text);
  font-size: 10.5px;
}
.search-row input { min-width: 0; padding: 0 9px 0 29px; }
.search-row select { padding: 0 7px; }
.search-row input:focus,
.search-row select:focus { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(77, 107, 254, 0.1); }

.orchestrator-node {
  min-height: 64px;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border: 1px solid #b9c8ff;
  border-radius: 8px;
  background: var(--surface-blue);
}
.orchestrator-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface);
  color: var(--blue);
  box-shadow: inset 0 0 0 1px #d7e0ff;
}
.orchestrator-icon svg { width: 21px; height: 21px; }
.orchestrator-info { display: flex; min-width: 0; flex-direction: column; gap: 3px; }
.orchestrator-line { display: flex; min-width: 0; align-items: center; }
.orchestrator-line strong { font-size: 12.5px; line-height: 18px; white-space: nowrap; }
.orchestrator-summary { overflow: hidden; color: var(--text-soft); font-size: 10px; line-height: 15px; text-overflow: ellipsis; white-space: nowrap; }
.work-state { flex: none; gap: 4px; color: var(--text-faint); font-size: 10px; white-space: nowrap; }
.work-state svg { width: 12px; height: 12px; }
.work-state.busy { color: var(--blue); }
.work-state.busy svg { animation: pulse 1.1s ease-in-out infinite; }

.progress-overview { display: flex; flex-direction: column; gap: 7px; }
.section-label { color: var(--text-soft); font-size: 10.5px; font-weight: 650; }
.progress-segments { display: flex; gap: 4px; min-height: 5px; }
.progress-segment,
.progress-empty { height: 5px; flex: 1; border-radius: 2px; background: var(--line-strong); }
.progress-segment.running { background: var(--blue); }
.progress-segment.waiting { background: var(--orange); }
.progress-segment.completed { background: var(--green); }
.progress-segment.failed { background: var(--red); }
.progress-legend { display: flex; flex-wrap: wrap; gap: 10px; color: var(--text-faint); font-size: 9.5px; }
.progress-legend span { display: inline-flex; align-items: center; gap: 4px; }
.progress-legend i { width: 6px; height: 6px; border-radius: 1.5px; background: currentColor; }
.progress-legend .running { color: var(--blue); }
.progress-legend .waiting { color: var(--orange); }
.progress-legend .completed { color: var(--green); }
.progress-legend .failed { color: var(--red); }
.progress-legend b { font-weight: 600; }
.bottom-dock { display: flex; flex: 0 0 auto; flex-direction: column; margin-top: auto; padding: 0 16px; background: var(--surface); }
.source-manager { flex: 1; min-height: 0; display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.source-search-row { position: relative; flex: 0 0 auto; padding: 10px 12px 8px; }
.source-search-row svg { position: absolute; top: 19px; left: 21px; width: 13px; height: 13px; color: var(--text-faint); }
.source-search-row input { width: 100%; height: 31px; padding: 0 9px 0 29px; border: 1px solid var(--line); border-radius: 6px; outline: none; font-size: 10.5px; }
.source-search-row input:focus { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(77, 107, 254, 0.1); }
.source-items { flex: 1; min-height: 0; overflow: auto; padding: 0 12px 12px; scrollbar-width: thin; scrollbar-color: #b8bec8 transparent; }
.source-tree-root { border-top: 1px solid var(--line); }
.source-tree-root > summary {
  min-height: 38px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 27px 14px;
  align-items: center;
  gap: 7px;
  padding: 3px 2px;
  cursor: pointer;
  list-style: none;
}
.source-tree-root > summary::-webkit-details-marker,
.source-category > summary::-webkit-details-marker { display: none; }
.source-tree-name { display: inline-flex; min-width: 0; align-items: center; gap: 7px; }
.source-tree-name svg { width: 14px; height: 14px; flex: none; color: var(--blue); }
.source-tree-name b { overflow: hidden; color: var(--text); font-size: 10.5px; text-overflow: ellipsis; white-space: nowrap; }
.source-tree-status { display: inline-flex; align-items: center; gap: 5px; color: var(--text-soft); font-size: 9.5px; white-space: nowrap; }
.source-tree-state-dot { width: 6px; height: 6px; flex: none; border-radius: 50%; background: var(--text-faint); }
.source-tree-state-dot.ok { background: var(--green); }
.source-tree-chevron { width: 12px; height: 12px; color: var(--text-faint); transition: transform 0.15s ease; }
.source-tree-root[open] > summary .source-tree-chevron { transform: rotate(90deg); }
.source-tree-branches { padding: 0 0 4px 21px; }
.source-scope { min-height: 34px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 7px; border-left: 1px solid var(--line); color: var(--text-faint); font-size: 9.5px; }
.source-scope b { color: var(--text-soft); font-size: 10px; font-weight: 500; text-align: right; }
.source-category { border-left: 1px solid var(--line); }
.source-category > summary {
  min-height: 31px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 7px;
  cursor: pointer;
  color: var(--text-soft);
  font-size: 10px;
  list-style: none;
}
.source-category > summary span { display: inline-flex; align-items: center; gap: 5px; }
.source-category > summary svg { width: 11px; height: 11px; transition: transform 0.15s ease; }
.source-category[open] > summary svg { transform: rotate(90deg); }
.source-category > summary b { color: var(--text-faint); font-size: 9.5px; font-weight: 500; }
.source-category-items { padding-left: 10px; }
.source-loading, .source-empty { min-height: 34px; display: grid; place-items: center; color: var(--text-faint); font-size: 9.5px; }
.source-loading svg { width: 13px; height: 13px; animation: source-spin 0.8s linear infinite; }
@keyframes source-spin { to { transform: rotate(360deg); } }
.source-entry {
  min-height: 42px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 5px 2px;
  border-top: 1px solid var(--line);
}
.source-entry-main { display: flex; min-width: 0; flex-direction: column; gap: 2px; }
.source-entry-main b { color: var(--text); font-size: 10.5px; line-height: 15px; overflow-wrap: anywhere; }
.source-entry-main small { overflow: hidden; color: var(--text-faint); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.source-entry-meta { color: var(--red); font-size: 9.5px; white-space: nowrap; }
.source-entry-meta.ok { color: var(--green); }
.source-restart { width: 27px; height: 27px; display: inline-grid; place-items: center; padding: 0; border: 0; border-radius: 5px; background: transparent; color: var(--text-soft); cursor: pointer; }
.source-restart:hover { background: var(--surface-soft); color: var(--blue); }
.source-restart:disabled { opacity: 0.45; cursor: default; }
.source-config-open { width: 27px; height: 27px; display: inline-grid; flex: none; place-items: center; padding: 0; border: 0; border-radius: 5px; background: transparent; color: var(--text-soft); cursor: pointer; }
.source-config-open:hover { background: var(--surface-soft); color: var(--blue); }
.source-config-open svg { width: 14px; height: 14px; }

.source-config-dialog { width: min(430px, calc(100vw - 32px)); max-height: min(660px, calc(100vh - 40px)); padding: 0; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow); }
.source-config-dialog::backdrop { background: rgba(32, 36, 43, 0.22); backdrop-filter: blur(2px); }
.source-config-form { display: flex; flex-direction: column; max-height: inherit; }
.source-config-form > header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.source-config-form > header strong { font-size: 12px; }
.source-config-body { flex: 1; min-height: 0; overflow: auto; display: grid; gap: 10px; align-content: start; padding: 12px 14px; }
.source-config-form > footer { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); }
.source-config-status { flex: 1; min-width: 0; overflow: hidden; color: var(--red); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.source-config-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.source-config-field { display: grid; gap: 4px; }
.source-config-field > span { color: var(--text-soft); font-size: 9.5px; }
.source-config-field input[type="text"], .source-config-field select, .source-config-field textarea { width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; outline: none; font-size: 10px; }
.source-config-field textarea { resize: vertical; font-family: ui-monospace, monospace; }
.source-config-check { display: flex; align-items: center; gap: 6px; font-size: 10px; }
.source-config-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.source-config-chip { padding: 3px 7px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-soft); color: var(--text-soft); font-size: 9px; cursor: pointer; }
.source-config-chip:hover { border-color: #e6b5b8; color: var(--red); }
.source-config-hint { display: block; color: var(--text-faint); font-size: 9px; line-height: 13px; }
.source-config-empty { color: var(--text-faint); font-size: 9px; }
.source-config-add { display: flex; gap: 6px; margin-top: 4px; }
.source-config-add input { flex: 1; }
.source-config-dialog.wide { width: min(560px, calc(100vw - 32px)); max-height: min(760px, calc(100vh - 40px)); }
.source-config-field input[type="password"] { width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; outline: none; font-size: 10px; }
.sc-section { display: grid; gap: 8px; padding-top: 10px; border-top: 1px solid var(--line); }
.sc-section:first-of-type { padding-top: 0; border-top: 0; }
.sc-section-title { display: flex; align-items: center; justify-content: space-between; font-size: 10.5px; font-weight: 650; }
.sc-link { padding: 0; border: 0; background: none; color: var(--blue); font-size: 9.5px; cursor: pointer; }
.sc-route { display: grid; grid-template-columns: 110px 1fr; gap: 10px; align-items: start; padding: 6px 0; border-top: 1px dashed var(--line); }
.sc-route:first-of-type { border-top: 0; }
.sc-route-name { font-size: 10px; font-weight: 600; }
.sc-route-name small { display: block; color: var(--text-faint); font-size: 9px; font-weight: 400; }
.sc-seg { display: inline-flex; margin-bottom: 4px; border: 1px solid var(--line-strong); border-radius: 6px; overflow: hidden; }
.sc-seg button { padding: 4px 10px; border: 0; border-right: 1px solid var(--line-strong); background: var(--surface); color: var(--text-soft); font-size: 9.5px; white-space: nowrap; cursor: pointer; }
.sc-seg button:last-child { border-right: 0; }
.sc-seg button.active { background: var(--blue-soft, #eef1ff); color: var(--blue); font-weight: 650; }
.sc-seg button.active.off { background: var(--surface-soft); color: var(--text); }
.sc-where { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-soft); font-size: 9.5px; }
.sc-where-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: #b8bec9; }
.sc-dot.ok { background: var(--green, #0e9f5b); }
.sc-dot.bad { background: var(--amber, #b26b00); }
.sc-perm { margin: 0; padding: 0; list-style: none; }
.sc-perm li { display: flex; gap: 8px; padding: 3px 0; border-bottom: 1px dashed var(--line); font-size: 9.5px; }
.sc-perm code { font-family: ui-monospace, monospace; font-size: 9px; }
.sc-perm em { color: var(--text-faint); font-style: normal; }
.sc-test { font-size: 9.5px; }
.sc-test.ok { color: var(--green, #0e9f5b); }
.sc-test.bad { color: var(--red); }
.sc-warn { display: block; padding: 6px 8px; border-radius: 6px; background: #fdf3e2; color: #b26b00; font-size: 9px; }
.source-restart svg { width: 13px; height: 13px; }
.source-load-more { width: 100%; min-height: 28px; border: 0; border-top: 1px solid var(--line); background: transparent; color: var(--blue); font-size: 9.5px; cursor: pointer; }
.source-load-more:hover { background: var(--surface-soft); }

.sessions-section { min-width: 0; }
.section-toggle {
  width: 100%;
  height: 31px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
  border: 0;
  border-radius: 7px;
  background: var(--surface-soft);
  color: var(--text-soft);
  cursor: pointer;
  font-size: 10.5px;
  font-weight: 650;
}
.section-toggle > span { gap: 5px; }
.section-toggle > span:last-child { color: var(--blue); }
.section-toggle .chevron { width: 13px; height: 13px; transition: transform 140ms ease; }
.section-toggle[aria-expanded="true"] .chevron { transform: rotate(90deg); }
.section-toggle b { font-weight: 650; }

.session-tree {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-left: 17px;
  overflow: visible;
  padding: 8px 0 0 20px;
}
.session-tree::before {
  position: absolute;
  top: 0;
  bottom: 24px;
  left: 0;
  width: 1px;
  background: #aebfff;
  content: "";
}
.session-tree.empty::before { display: none; }
.session-item { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 28px; align-items: center; gap: 3px; padding: 2px 0 6px; }
.session-item::before {
  position: absolute;
  top: 28px;
  right: 100%;
  width: 20px;
  height: 1px;
  background: #aebfff;
  content: "";
}
.session-item::after {
  position: absolute;
  top: 26px;
  left: -2px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--blue);
  content: "";
}
.session-row {
  width: 100%;
  min-height: 58px;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 5px 7px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.session-row:hover { background: var(--surface-soft); }
.session-row.selected,
.session-row.running { border-color: transparent; background: var(--surface-blue); }
.session-avatar {
  position: relative;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #eaf0ff;
  color: var(--blue);
}
.session-avatar svg { width: 15px; height: 15px; }
.session-avatar .state-mark {
  position: absolute;
  right: -2px;
  bottom: -1px;
  width: 15px;
  height: 15px;
  display: grid;
  place-items: center;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--text-faint);
  color: white;
}
.session-row.running .state-mark { background: var(--blue); }
.session-row.waiting .state-mark { background: var(--orange); }
.session-row.completed .state-mark { background: var(--green); }
.session-row.failed .state-mark { background: var(--red); }
.state-mark svg { width: 8px; height: 8px; }
.session-info { display: flex; min-width: 0; flex-direction: column; gap: 4px; }
.session-name {
  display: -webkit-box;
  overflow: hidden;
  font-size: 11px;
  font-weight: 650;
  line-height: 15px;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.session-status { align-self: start; margin-top: 2px; color: var(--text-faint); font-size: 9.5px; white-space: nowrap; }
.session-row.running .session-status { color: var(--blue); }
.session-row.waiting .session-status { color: var(--orange); }
.session-row.completed .session-status { color: var(--green); }
.session-row.failed .session-status { color: var(--red); }
.session-subline { display: flex; min-width: 0; align-items: center; gap: 7px; color: var(--text-faint); font-size: 9.5px; line-height: 14px; }
.session-subline b { flex: none; color: var(--blue); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.session-subline span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty-compact { padding: 14px 6px; color: var(--text-faint); text-align: center; font-size: 10px; }
.list-more {
  min-height: 29px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--blue);
  cursor: pointer;
  font-size: 9.5px;
}
.list-more:hover { background: var(--surface-blue); }
.list-more span { margin-left: 4px; color: var(--text-faint); }
.session-tree > .list-more { margin: 4px 0 8px; }
.conversation-more { width: 100%; margin-bottom: 14px; }

.task-structure-section { min-width: 0; padding-top: 10px; border-top: 1px solid var(--line); }
.task-structure-section > summary { cursor: pointer; list-style: none; }
.task-structure-section > summary::-webkit-details-marker { display: none; }
.task-structure-section[open] > summary { margin-bottom: 8px; }
.relation-summary-meta { display: inline-flex; align-items: center; gap: 5px; }
.relation-summary-meta svg { width: 13px; height: 13px; transition: transform 160ms ease; }
.task-structure-section[open] .relation-summary-meta svg { transform: rotate(90deg); }
.relation-graph { display: flex; min-width: 0; flex-direction: column; gap: 7px; overflow: hidden; }
.relation-flow {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  min-width: 0;
  gap: 6px 4px;
  padding: 1px;
  overflow: hidden;
}
.relation-step { display: flex; min-width: 0; align-items: center; gap: 3px; }
.relation-component {
  min-height: 34px;
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  align-items: center;
  gap: 5px;
  padding: 5px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text-soft);
}
.relation-component > svg { width: 12px; height: 12px; flex: none; }
.relation-component > span { min-width: 0; overflow: hidden; font-size: 9px; line-height: 12px; text-overflow: ellipsis; white-space: nowrap; }
.relation-component.kind-source { border-color: #c6d4ff; background: #f2f5ff; color: #4167d8; }
.relation-component.kind-router { border-color: #d8dee8; background: #f6f7f9; color: #667085; }
.relation-component.kind-approval { border-color: #efd29a; background: #fff8e9; color: #b36a00; }
.relation-component.kind-skill { border-color: #d8c9f1; background: #f8f3ff; color: #7351a6; }
.relation-component.kind-session { border-color: #b9dedd; background: #effafa; color: #237b78; }
.relation-component.kind-result { border-color: #b7dfc8; background: var(--green-soft); color: var(--green); }
.relation-component.state-waiting { border-color: #efd29a; background: var(--orange-soft); color: var(--orange); }
.relation-component.state-failed { border-color: #e6b5b8; background: var(--red-soft); color: var(--red); }
.relation-arrow { width: 12px; display: inline-grid; flex: 0 0 12px; place-items: center; color: var(--text-faint); }
.relation-arrow svg { width: 10px; height: 10px; }
.relation-group { display: flex; min-width: 0; flex-direction: column; gap: 5px; }
.relation-group-label { color: var(--text-faint); font-size: 9px; }
.relation-task-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.relation-task { min-height: 34px; display: flex; min-width: 0; align-items: center; gap: 6px; padding: 5px 7px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); text-align: left; cursor: pointer; }
.relation-task:hover { background: var(--surface-blue); }
.relation-task b { flex: none; color: var(--blue); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 9.5px; }
.relation-task span { min-width: 0; overflow: hidden; color: var(--text-soft); font-size: 9.5px; text-overflow: ellipsis; white-space: nowrap; }
.structure-empty { color: var(--text-faint); font-size: 9.5px; }

.token-usage { display: inline-flex; flex: none; align-items: center; color: #6f5b9c; font-size: 8.5px; white-space: nowrap; }
.session-token { max-width: 68px; overflow: hidden; text-overflow: ellipsis; }
.history-token { max-width: 78px; overflow: hidden; text-overflow: ellipsis; }

.approvals-section { min-height: 0; display: flex; min-width: 0; flex-direction: column; gap: 8px; padding: 10px 0 8px; border-top: 1px solid var(--line); background: var(--surface); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.section-heading > span { gap: 6px; color: var(--text-soft); font-size: 10.5px; font-weight: 650; }
.section-heading svg { width: 14px; height: 14px; }
.section-heading small { overflow: hidden; color: var(--text-faint); font-size: 9.5px; text-overflow: ellipsis; white-space: nowrap; }

.approval-heading b {
  min-width: 20px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  border-radius: 4px;
  background: var(--orange-soft);
  color: var(--orange);
  font-size: 9px;
}
.approval-list { display: grid; gap: 7px; overflow: visible; }
.manual-empty { padding: 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-soft); color: var(--text-faint); font-size: 9.5px; text-align: center; }
.attention-task { min-height: 46px; display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); text-align: left; cursor: pointer; }
.attention-item { display: flex; min-width: 0; align-items: center; gap: 4px; }
.attention-item .attention-task { flex: 1; }
.attention-task:hover { background: var(--surface-blue); }
.attention-task-main { display: flex; min-width: 0; flex-direction: column; gap: 3px; }
.attention-task-main strong,
.attention-task-main small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attention-task-main strong { color: var(--text); font-size: 10px; }
.attention-task-main small { color: var(--text-faint); font-size: 9px; }
.attention-task .status-badge { flex: none; }
.attention-type { flex: none; padding: 1px 5px; border-radius: 4px; background: var(--surface-soft); color: var(--text-soft); font-size: 8.5px; font-weight: 650; }
.attention-task-main small .attention-type { margin-right: 4px; }
.approval-item { padding: 9px; border: 1px solid #efd29a; border-radius: 7px; background: #fffbf3; }
.approval-title-row { display: flex; min-width: 0; align-items: center; justify-content: space-between; gap: 6px; }
.approval-item h3 { margin: 0; font-size: 10.5px; }
.approval-item p { margin: 5px 0; color: var(--text-soft); font-size: 9.5px; line-height: 14px; overflow-wrap: anywhere; }
.approval-target { display: block; margin-bottom: 7px; color: #8e5d0c; font-size: 9px; }
.approval-scope { margin-bottom: 7px; padding: 6px; border: 1px solid #d8e0ed; border-radius: 5px; background: white; color: var(--text-soft); font-size: 9px; overflow-wrap: anywhere; }
.approval-item input { width: 100%; height: 30px; margin-bottom: 7px; padding: 0 7px; border: 1px solid var(--line-strong); border-radius: 5px; background: white; font-size: 10px; }
.approval-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.command-button { min-height: 29px; padding: 0 9px; border: 1px solid var(--line-strong); border-radius: 5px; background: white; cursor: pointer; font-size: 9.5px; font-weight: 650; }
.command-button.approve { border-color: var(--blue); background: var(--blue); color: white; }
.command-button.permanent { border-color: #7757a8; background: #7757a8; color: white; }
.command-button.reject { border-color: #e6b5b8; color: var(--red); }
.open-codex-button { width: 27px; height: 27px; display: inline-grid; flex: none; place-items: center; padding: 0; border: 0; border-radius: 5px; background: transparent; color: var(--text-soft); cursor: pointer; }
.open-codex-button:hover { background: var(--surface-soft); color: var(--blue); }
.open-codex-button:disabled { opacity: 0.45; cursor: default; }
.open-codex-button svg { width: 14px; height: 14px; }
.retry-task-button { width: 27px; height: 27px; display: inline-grid; flex: none; place-items: center; padding: 0; border: 0; border-radius: 5px; background: transparent; color: var(--text-soft); cursor: pointer; }
.retry-task-button:hover { background: var(--surface-blue); color: var(--blue); }
.retry-task-button:disabled { opacity: 0.45; cursor: default; }
.retry-task-button svg { width: 14px; height: 14px; }
.close-task-button { width: 27px; height: 27px; display: inline-grid; place-items: center; padding: 0; border: 0; border-radius: 5px; background: transparent; color: var(--text-faint); cursor: pointer; }
.close-task-button:hover { background: var(--red-soft); color: var(--red); }
.close-task-button:disabled { opacity: 0.45; cursor: default; }
.close-task-button svg { width: 14px; height: 14px; }

.panel-footer {
  position: relative;
  z-index: 2;
  min-height: 42px;
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  padding: 6px 10px 6px 14px;
  border-top: 1px solid var(--line);
  background: var(--surface);
  overflow: hidden;
}
.source-summary { display: flex; flex: none; min-width: 0; align-items: center; margin-right: auto; padding: 4px 5px; border: 0; border-radius: 5px; background: transparent; cursor: pointer; }
.source-summary:hover { background: var(--surface-soft); }
.source-list { display: flex; min-width: 0; align-items: center; gap: 8px; overflow: hidden; }
.source-item { display: inline-flex; min-width: 0; align-items: center; gap: 5px; color: var(--text-soft); font-size: 9.5px; }
.source-item > i { width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--text-faint); }
.source-item.ok > i { background: var(--green); }
.source-name { flex: none; white-space: nowrap; }
.skill-summary {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 5px;
  padding: 4px 5px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  font-size: 9.5px;
  white-space: nowrap;
}
.skill-summary:hover { background: var(--surface-soft); color: var(--blue); }
.skill-summary svg { width: 12px; height: 12px; }
.update-action {
  width: 24px;
  height: 24px;
  display: inline-grid;
  flex: none;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #3b91f7;
  color: white;
  box-shadow: 0 1px 4px rgba(59, 145, 247, 0.24);
  cursor: pointer;
}
.update-action:hover { background: #247fe7; }
.update-action:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.update-action:disabled { cursor: default; }
.update-action svg { width: 13px; height: 13px; display: block; transform: translateY(-0.5px); }
.update-action.has-text {
  width: auto;
  min-width: 64px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  line-height: 24px;
  white-space: nowrap;
}
.update-action.is-downloading { background: #7aaef0; }
.update-action.is-downloaded { background: #5f75df; box-shadow: 0 1px 4px rgba(95, 117, 223, 0.22); }
.update-action.is-error { background: var(--red); }

.task-drawer { display: flex; min-height: 0; flex-direction: column; }
.empty-detail { flex: 1; display: grid; place-content: center; justify-items: center; gap: 9px; color: var(--text-faint); font-size: 11px; }
.empty-detail svg { width: 23px; height: 23px; }
.task-detail { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.drawer-header {
  min-height: 52px;
  display: grid;
  flex: 0 0 auto;
  grid-template-columns: minmax(0, 1fr) auto;
  min-width: 0;
  align-items: center;
  gap: 8px;
  padding: 0 12px 0 16px;
}
.drawer-title { display: flex; min-width: 0; align-items: center; gap: 8px; overflow: hidden; }
.detail-back { display: none; flex: none; }
.task-code { color: var(--blue); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; font-weight: 750; text-transform: uppercase; }
.drawer-title > .task-code { min-width: 24px; flex: none; }
.drawer-actions { flex: none; gap: 5px; }
.detail-summary {
  min-height: 54px;
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  padding: 8px 16px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}
.detail-summary h2 {
  margin: 0;
  display: -webkit-box;
  overflow: hidden;
  font-size: 12px;
  line-height: 16px;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.detail-summary p {
  margin: 0;
  overflow: hidden;
  color: var(--text-soft);
  font-size: 9.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.detail-meta-row { display: flex; min-width: 0; align-items: center; gap: 8px; }
.detail-meta-row p { flex: 1 1 auto; min-width: 0; }
.detail-token-usage { flex: 0 1 auto; max-width: 62%; color: #6f5b9c; font-size: 9px; line-height: 1.45; text-align: right; white-space: normal; }
.detail-token-usage.empty { color: var(--text-faint); }
.detail-original-message { flex: 0 0 auto; padding: 8px 16px 10px; border-bottom: 1px solid var(--line); }
.detail-original-message > span { display: block; margin-bottom: 5px; color: var(--text-faint); font-size: 9px; }
.detail-original-message > p { max-height: 96px; margin: 0; overflow: auto; color: var(--text); font-size: 10.5px; line-height: 1.55; overflow-wrap: anywhere; white-space: pre-wrap; scrollbar-width: thin; scrollbar-color: #b8bec8 transparent; }
.status-badge {
  min-height: 20px;
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--surface-soft);
  color: var(--text-soft);
  font-size: 9px;
  font-weight: 650;
}
.status-badge.running { background: var(--blue); color: white; }
.status-badge.waiting { background: var(--orange); color: white; }
.status-badge.completed { background: var(--green); color: white; }
.status-badge.failed { background: var(--red); color: white; }
.status-badge.unmatched { background: var(--surface-soft); color: var(--text-soft); }
.drawer-tabs { height: 36px; display: flex; flex: 0 0 36px; gap: 20px; padding: 0 16px; border-bottom: 1px solid var(--line); }
.drawer-tab { position: relative; padding: 0 2px; border: 0; background: transparent; color: var(--text-soft); cursor: pointer; font-size: 10.5px; }
.drawer-tab.active { color: var(--text); font-weight: 650; }
.drawer-tab.active::after { position: absolute; right: 0; bottom: -1px; left: 0; height: 2px; background: var(--blue); content: ""; }
.conversation-view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.conversation { flex: 1; min-height: 0; overflow: auto; padding: 16px; }
.message { max-width: 88%; margin-bottom: 14px; }
.message.user { margin-left: auto; }
.message-role { margin-bottom: 4px; display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--text-faint); font-size: 9.5px; }
.message.user .message-role { text-align: right; }
.message-body { padding: 9px 11px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-soft); font-size: 11.5px; line-height: 1.6; overflow-wrap: anywhere; white-space: pre-wrap; }
.message.user .message-body { border-color: #c9d5ff; background: var(--surface-blue); color: #294389; }
.timeline-view { flex: 1; min-height: 0; overflow: auto; padding: 18px; }
.timeline-item { position: relative; padding: 0 0 17px 20px; border-left: 1px solid var(--line); }
.timeline-item:last-child { border-left-color: transparent; }
.timeline-dot { position: absolute; top: 3px; left: -4px; width: 7px; height: 7px; border: 2px solid white; border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 1px var(--blue); }
.timeline-item.failed .timeline-dot { background: var(--red); box-shadow: 0 0 0 1px var(--red); }
.timeline-title { font-size: 10.5px; font-weight: 650; }
.timeline-time,
.timeline-detail { margin-top: 3px; color: var(--text-faint); font-size: 9px; overflow-wrap: anywhere; }

.skill-drawer { display: none; }
body.skill-open .monitor-panel,
body.skill-open #task-drawer,
body.skill-open .source-drawer { display: none; }
body.skill-open .skill-drawer { display: flex; }
.skill-count { min-width: 18px; color: var(--text-faint); font-size: 9.5px; font-weight: 500; }
.skill-manager { flex: 1; min-height: 0; display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.skill-search-row { position: relative; flex: 0 0 auto; padding: 10px 12px 8px; }
.skill-search-row svg { position: absolute; top: 19px; left: 21px; width: 13px; height: 13px; color: var(--text-faint); }
.skill-search-row input { width: 100%; height: 31px; padding: 0 9px 0 29px; border: 1px solid var(--line); border-radius: 6px; outline: none; font-size: 10.5px; }
.skill-search-row input:focus { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(77, 107, 254, 0.1); }
.skill-list { display: grid; flex: 1; min-height: 0; align-content: start; gap: 5px; overflow: auto; padding: 0 12px 12px; scrollbar-width: thin; }
.skill-row { display: block; padding: 7px 7px 7px 9px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.skill-row:hover { border-color: #c9d5ff; background: var(--surface-blue); }
.skill-row-head { min-height: 38px; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 8px; }
.skill-row-main { display: flex; min-width: 0; flex-direction: column; gap: 3px; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; }
button.skill-row-main { cursor: pointer; }
.skill-params-toggle { width: 27px; height: 27px; display: inline-grid; flex: none; place-items: center; padding: 0; border: 0; border-radius: 5px; background: transparent; color: var(--text-soft); cursor: pointer; }
.skill-params-toggle:hover { background: var(--surface-soft); color: var(--blue); }
.skill-params-toggle svg { width: 14px; height: 14px; }
.skill-params { margin-top: 8px; padding-top: 9px; display: grid; gap: 8px; border-top: 1px solid var(--line); }
.skill-param-field { display: grid; gap: 3px; }
.skill-param-field > span { color: var(--text-soft); font-size: 9px; }
.skill-param-field > span b { color: var(--red); font-weight: 700; }
.skill-param-field input[type="text"], .skill-param-field input[type="password"], .skill-param-field input[type="number"], .skill-param-field textarea { width: 100%; padding: 5px 7px; border: 1px solid var(--line); border-radius: 5px; outline: none; font-size: 9.5px; }
.skill-param-field input:focus, .skill-param-field textarea:focus { border-color: var(--blue); }
.skill-param-check { display: flex; align-items: center; gap: 6px; font-size: 9.5px; }
.skill-param-help { color: var(--text-faint); font-size: 8.5px; }
.skill-param-empty { color: var(--text-faint); font-size: 9.5px; }
.skill-param-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.skill-param-status { margin-right: auto; color: var(--red); font-size: 9px; }
.skill-row-main strong { overflow: hidden; font-size: 10.5px; text-overflow: ellipsis; white-space: nowrap; }
.skill-source { display: inline-flex; margin-left: 4px; padding: 1px 4px; border-radius: 4px; color: var(--text-faint); background: var(--surface-soft); font-size: 8px; font-style: normal; font-weight: 600; vertical-align: 1px; }
.skill-source.official { color: #315ed4; background: #edf2ff; }
.skill-source.customer { color: #237a46; background: #edf8f1; }
.skill-row-main small { display: -webkit-box; overflow: hidden; color: var(--text-faint); font-size: 9px; line-height: 13px; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.skill-official-lock { display: grid; width: 28px; height: 28px; place-items: center; color: var(--text-faint); }
.skill-official-lock svg { width: 13px; height: 13px; }

.source-drawer { display: none; }
body.source-open .monitor-panel,
body.source-open #task-drawer,
body.source-open .skill-drawer,
body.source-open .history-drawer { display: none; }
body.source-open .source-drawer { display: flex; }

.history-drawer { display: none; }
body.history-open .monitor-panel,
body.history-open #task-drawer,
body.history-open .skill-drawer,
body.history-open .source-drawer { display: none; }
body.history-open .history-drawer { display: flex; }
.history-total { min-width: 18px; color: var(--text-faint); font-size: 9.5px; font-weight: 500; }
.history-month-switcher { display: inline-flex; flex: none; align-items: center; gap: 2px; color: var(--text-soft); }
.history-month-switcher .icon-button { width: 26px; height: 26px; }
.history-month-switcher .icon-button:disabled { color: var(--text-faint); cursor: default; opacity: 0.45; }
.history-month-switcher span { min-width: 62px; font-size: 9.5px; font-weight: 600; text-align: center; white-space: nowrap; }
.history-page { flex: 1; min-height: 0; overflow: auto; padding: 14px; scrollbar-width: thin; scrollbar-color: #b8bec8 transparent; }
.history-overview { padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.history-day-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.history-heatmap { width: 100%; }
.history-calendar-weekdays,
.history-calendar-days {
  --history-cell-size: clamp(30px, 8vw, 38px);
  display: grid;
  grid-template-columns: repeat(7, var(--history-cell-size));
  justify-content: center;
  gap: 5px;
}
.history-calendar-weekdays { margin-bottom: 4px; color: var(--text-faint); font-size: 7.5px; text-align: center; }
.history-calendar-days { align-content: start; }
.history-day,
.history-day-spacer { width: var(--history-cell-size); height: var(--history-cell-size); border-radius: 3px; }
.history-day { display: grid; place-items: center; padding: 0; border: 1px solid rgba(27, 31, 36, 0.05); color: var(--text-soft); cursor: pointer; font-size: 7.5px; transition: transform 100ms ease, box-shadow 100ms ease; }
.history-day:hover { transform: scale(1.18); box-shadow: 0 0 0 1px var(--text-soft); }
.history-day.selected { box-shadow: 0 0 0 2px var(--blue); }
.history-day.level-0 { background: #f0f2f5; }
.history-day.level-1 { background: #d8f1e2; }
.history-day.level-2 { background: #9ed8b6; }
.history-day.level-3 { background: #4eb87a; color: white; }
.history-day.level-4 { background: #197a46; color: white; }
.history-day-section { margin-top: 14px; }
.history-day-heading { min-height: 32px; margin-bottom: 7px; padding: 0 2px; }
.history-day-heading strong { font-size: 11px; }
.history-day-heading span { color: var(--text-faint); font-size: 9.5px; }
.history-day-list { display: grid; gap: 6px; }
.history-task-row {
  min-height: 52px;
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr) auto auto 28px;
  align-items: center;
  gap: 8px;
  padding: 7px 7px 7px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
}
.history-task-row[data-history-task-id] { cursor: pointer; }
.history-task-row[data-history-task-id]:hover { border-color: #c6d4ff; background: #f7f9ff; }
.history-task-row[data-history-task-id]:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.history-task-row:hover { border-color: #c9d5ff; background: var(--surface-blue); }
.history-task-main { display: flex; min-width: 0; flex-direction: column; gap: 4px; }
.history-task-main strong { overflow: hidden; font-size: 10.5px; text-overflow: ellipsis; white-space: nowrap; }
.history-task-main small { overflow: hidden; color: var(--text-faint); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.history-day-section > .list-more { width: 100%; margin-top: 8px; }

.toast { position: fixed; right: 12px; bottom: 52px; z-index: 10; max-width: min(340px, calc(100vw - 24px)); padding: 9px 12px; border-radius: 6px; background: #242a32; color: white; box-shadow: var(--shadow); font-size: 10.5px; }
.toast.error { background: #9d3035; }

@keyframes pulse {
  0%, 100% { opacity: 0.42; }
  50% { opacity: 1; }
}

@media (max-width: 980px) {
  .activity-workspace { grid-template-columns: minmax(360px, 1fr) minmax(400px, 1fr); gap: 10px; padding: 10px; }
  .monitor-panel, .task-drawer { height: calc(100svh - 20px); }
  .activity-stats { gap: 6px; }
}

@media (max-width: 760px) {
  .activity-workspace { display: flex; flex-direction: column; min-height: auto; padding: 8px; }
  .monitor-panel, .task-drawer { width: 100%; height: auto; min-height: 0; border-radius: 9px; }
  .monitor-panel { max-height: none; }
  .panel-scroll { overflow: visible; }
  .task-drawer { min-height: 68svh; }
  .activity-heading { align-items: flex-start; flex-direction: column; gap: 5px; }
  .activity-stats { width: 100%; justify-content: space-between; }
}

@media (max-width: 430px) {
  .activity-workspace { padding: 0; }
  .monitor-panel, .task-drawer { border-right: 0; border-left: 0; border-radius: 0; box-shadow: none; }
  .panel-header { padding-left: 12px; }
  .activity-section { padding: 12px 12px 0; }
  .bottom-dock { padding: 0 12px; }
  .activity-stats { font-size: 9px; }
  .orchestrator-node { grid-template-columns: 40px minmax(0, 1fr); }
  .orchestrator-icon { width: 36px; height: 36px; }
  .work-state { grid-column: 2; justify-self: start; }
  .search-row { grid-template-columns: 1fr 96px; }
  .session-tree { margin-left: 10px; padding-left: 15px; }
  .session-item::before { width: 15px; }
  .relation-flow { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .drawer-header { padding-right: 10px; padding-left: 12px; }
  .message { max-width: 94%; }
}

@media (max-width: 400px) {
  .desktop-surface .title-context { display: none; }
}

body.desktop-surface { overflow: hidden; background: var(--surface); }
.desktop-surface .activity-workspace { display: block; min-height: 100svh; padding: 0; }
.desktop-surface .panel-scroll { overflow: auto; }
.desktop-surface .panel-header { padding-left: 84px; }
.desktop-surface .panel-header {
  min-height: 42px;
  display: grid;
  flex-basis: 42px;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}
.desktop-surface .panel-title { overflow: hidden; }
.desktop-surface .panel-logo { width: 20px; height: 20px; border-radius: 5px; }
.desktop-surface .panel-logo svg { width: 13px; height: 13px; }
.desktop-surface .panel-title strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.desktop-surface .desktop-only { display: inline-grid !important; }
.desktop-surface [data-tauri-drag-region] { user-select: none; }
.desktop-surface .monitor-panel,
.desktop-surface .task-drawer {
  width: 100%;
  height: 100svh;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.desktop-surface .task-drawer { display: none; }
.desktop-surface.detail-open .monitor-panel { display: none; }
.desktop-surface.detail-open #task-drawer { display: flex; }
.desktop-surface.skill-open .monitor-panel,
.desktop-surface.skill-open #task-drawer,
.desktop-surface.skill-open .source-drawer { display: none; }
.desktop-surface.skill-open .skill-drawer { display: flex; }
.desktop-surface.source-open .monitor-panel,
.desktop-surface.source-open #task-drawer,
.desktop-surface.source-open .skill-drawer,
.desktop-surface.source-open .history-drawer { display: none; }
.desktop-surface.source-open .source-drawer { display: flex; }
.desktop-surface.history-open .monitor-panel,
.desktop-surface.history-open #task-drawer,
.desktop-surface.history-open .skill-drawer,
.desktop-surface.history-open .source-drawer { display: none; }
.desktop-surface.history-open .history-drawer { display: flex; }
.desktop-surface .detail-back { display: inline-grid; }
.desktop-surface .drawer-header {
  min-height: 42px;
  flex-basis: 42px;
  padding: 0 10px 0 84px;
}

/* ── dsh 对话面板 ─────────────────────────────────────── */
.dsh-panel { display: none; }
body.dsh-open .dsh-panel { display: flex; }
body.dsh-open .activity-workspace {
  grid-template-columns: minmax(320px, 440px) minmax(360px, 480px) minmax(420px, 1fr);
  justify-content: stretch;
}
body.dsh-open.skill-open .activity-workspace,
body.dsh-open.source-open .activity-workspace,
body.dsh-open.history-open .activity-workspace {
  grid-template-columns: minmax(420px, 520px) minmax(440px, 720px);
}
body.dsh-open.skill-open .dsh-panel,
body.dsh-open.source-open .dsh-panel,
body.dsh-open.history-open .dsh-panel { display: none; }

.dsh-runtime-tag {
  flex: none;
  padding: 1px 6px;
  border: 1px solid #b9c8ff;
  border-radius: 4px;
  background: var(--surface-blue);
  color: #315ed4;
  font-size: 8.5px;
  font-weight: 700;
}
.dsh-runtime-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
  font-size: 9.5px;
  color: var(--text-faint);
}
.dsh-health { display: inline-flex; align-items: center; gap: 5px; color: var(--text-soft); font-weight: 600; }
.dsh-health::before { width: 6px; height: 6px; border-radius: 50%; background: var(--text-faint); content: ""; }
.dsh-health.ok { color: var(--green); }
.dsh-health.ok::before { background: var(--green); }
.dsh-health.error { color: var(--red); }
.dsh-health.error::before { background: var(--red); }
.dsh-meta { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dsh-view { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.dsh-conversation { padding: 16px 18px 22px; }
.dsh-empty { padding: 26px 12px; color: var(--text-faint); font-size: 10.5px; text-align: center; }
.dsh-empty button { margin-top: 10px; }
.dsh-msg { margin-bottom: 16px; animation: dsh-msg-in 0.18s ease-out; }
.dsh-msg-role { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; color: var(--text-faint); font-size: 9.5px; font-weight: 650; }
.dsh-msg-tag { margin-left: 6px; color: var(--text-faint); font-weight: 400; }
.dsh-msg-copy { border: 0; padding: 0; background: transparent; color: var(--text-faint); font-size: 9px; opacity: 0; cursor: pointer; transition: opacity 0.15s ease; }
.dsh-msg:hover .dsh-msg-copy { opacity: 1; }
.dsh-msg-copy:hover { color: var(--blue); }
.dsh-msg.user { display: flex; flex-direction: column; align-items: flex-end; }
.dsh-msg.assistant .message-body { padding: 0; border: 0; background: transparent; white-space: normal; }
.dsh-msg.user .message-body { max-width: 86%; }
.dsh-live { display: flex; align-items: center; gap: 7px; margin: 0 0 14px; color: var(--text-soft); font-size: 10.5px; }
.dsh-live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--blue); animation: dsh-pulse 1s ease-in-out infinite; }
.dsh-thought { margin: 0 0 12px; }
.dsh-thought-toggle { display: inline-flex; align-items: center; gap: 3px; color: var(--text-faint); cursor: pointer; font-size: 10px; font-weight: 650; list-style: none; }
.dsh-thought-toggle::-webkit-details-marker { display: none; }
.dsh-thought-toggle:hover { color: var(--text-soft); }
.dsh-chevron { flex: none; transition: transform 0.12s ease; }
.dsh-thought[open] .dsh-chevron { transform: rotate(90deg); }
.dsh-thought-quote { margin: 6px 0 0 2px; padding-left: 8px; border-left: 2px solid var(--line-strong); color: var(--text-soft); font-size: 10.5px; line-height: 1.75; }
.dsh-thought-quote p { margin: 0 0 6px; }
.dsh-thought-quote p:last-child { margin-bottom: 0; }
.dsh-jump { position: absolute; right: 18px; bottom: 14px; z-index: 3; height: 26px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12); color: var(--text-soft); font-size: 10px; cursor: pointer; }
.dsh-jump.hidden { display: none; }
@keyframes dsh-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
@keyframes dsh-msg-in {
  from { opacity: 0; transform: translateY(3px); }
  to { opacity: 1; transform: none; }
}
.dsh-timeline { padding: 16px; }
.dsh-capability { flex: 1; min-height: 0; overflow: auto; padding: 14px; }
.dsh-cap-table { width: 100%; border-collapse: collapse; font-size: 10px; }
.dsh-cap-table th,
.dsh-cap-table td { padding: 6px 7px; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.dsh-cap-table th { background: var(--surface-soft); color: var(--text-soft); font-weight: 650; }
.dsh-cap-note { margin: 10px 0 0; color: var(--text-faint); font-size: 9.5px; line-height: 1.6; }
.dsh-composer { flex: 0 0 auto; padding: 10px 14px 14px; background: var(--surface); }
.dsh-composer-box {
  position: relative;
  display: flex; flex-direction: column; gap: 6px;
  padding: 10px 10px 8px 12px;
  border: 1px solid var(--line-strong); border-radius: 14px;
  background: var(--surface); box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.dsh-composer-box:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(77, 107, 254, 0.1); }
.dsh-composer-box textarea {
  width: 100%; min-height: 24px; max-height: 168px; resize: none;
  border: 0; outline: none; background: transparent; color: var(--text);
  font-size: 12px; line-height: 1.6;
}
.dsh-composer-box textarea::placeholder { color: var(--text-faint); }
.dsh-composer-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dsh-composer-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.dsh-composer-icon { width: 26px; height: 26px; display: inline-grid; flex: none; place-items: center; padding: 0; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); color: var(--text-soft); cursor: pointer; }
.dsh-composer-icon:hover { border-color: var(--blue); color: var(--blue); }
.dsh-composer-icon svg { width: 14px; height: 14px; }
.dsh-composer-hint { overflow: hidden; color: var(--text-faint); font-size: 9.5px; text-overflow: ellipsis; white-space: nowrap; }
.dsh-file-input { display: none; }
.dsh-send { width: 30px; height: 30px; display: inline-grid; flex: none; place-items: center; padding: 0; border: 0; border-radius: 999px; background: var(--blue); color: #fff; cursor: pointer; transition: opacity 0.12s ease, background 0.12s ease; }
.dsh-send:hover { background: #3f5cf0; }
.dsh-send:disabled { background: #c8d0e0; cursor: default; }
.dsh-send svg { width: 16px; height: 16px; }

/* 输入框上的模型与推理等级选择器（对齐 dsh 官方 model-selection 组件结构） */
.dsh-composer-right { display: flex; align-items: center; gap: 6px; }
.composer-trigger {
  display: flex; align-items: center; gap: 4px; min-width: 0; max-width: min(260px, 45cqw); height: 28px;
  padding: 0 4px 0 8px; border: 0; border-radius: 24px; outline: none; background: none;
  color: var(--text-soft); font-size: 11.5px; font-weight: 500; cursor: pointer;
}
.composer-trigger:hover { background: var(--surface-soft); }
.composer-trigger:focus-visible { box-shadow: 0 0 0 2px rgba(77, 107, 254, 0.2); }
.composer-trigger-label { min-width: 0; overflow: hidden; color: var(--text); text-overflow: ellipsis; white-space: nowrap; }
.composer-trigger-effort { min-width: 0; overflow: hidden; color: var(--text-faint); text-overflow: ellipsis; white-space: nowrap; flex-shrink: 1000; }
.composer-trigger svg { flex: none; width: 12px; height: 12px; color: var(--text-faint); transition: transform 0.12s ease; }
.composer-trigger.open svg { transform: rotate(180deg); }

.composer-menu {
  position: absolute; right: 0; bottom: calc(100% + 6px); z-index: 1100;
  display: flex; flex-direction: column; width: max-content; min-width: min(240px, 100%);
  max-width: min(320px, calc(100vw - 32px)); max-height: min(320px, 60vh);
  padding: 4px; overflow: hidden; border: 1px solid var(--line-strong); border-radius: 16px;
  background: var(--surface); box-shadow: var(--shadow);
}
.composer-cell {
  display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px;
  border: 0; border-radius: 10px; background: none; color: var(--text); font-size: 11.5px; line-height: 1.5; text-align: left; cursor: pointer;
}
.composer-cell:hover { background: var(--surface-soft); }
.composer-cell-label { flex: none; }
.composer-cell-value { flex: 1; min-width: 0; overflow: hidden; color: var(--text-faint); text-align: right; text-overflow: ellipsis; white-space: nowrap; }
.composer-cell svg { flex: none; width: 12px; height: 12px; color: var(--text-faint); }
.composer-groups { min-height: 0; overflow-y: auto; padding: 1px 0; }
.composer-group + .composer-group { margin-top: 4px; }
.composer-group-title {
  position: sticky; top: 0; z-index: 1; padding: 5px 8px 3px;
  background: var(--surface); color: var(--text-faint); font-size: 10px; font-weight: 500; line-height: 1.5;
}
.composer-option {
  display: flex; align-items: center; gap: 8px; width: 100%; min-height: 32px; padding: 6px 8px;
  border: 0; border-radius: 10px; background: none; color: var(--text); font-size: 11.5px; font-weight: 500; text-align: left; cursor: pointer;
}
.composer-option:hover { background: var(--surface-soft); }
.composer-option-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.composer-option-check { display: grid; flex: 0 0 14px; place-items: center; visibility: hidden; color: var(--text); }
.composer-option.active .composer-option-check { visibility: visible; }
.composer-option-check svg { width: 13px; height: 13px; }
.composer-empty { padding: 10px; color: var(--text-faint); font-size: 11.5px; line-height: 1.6; }
.dsh-tool { margin: 0 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); overflow: hidden; animation: dsh-msg-in 0.18s ease-out; }
.dsh-tool-head { display: flex; align-items: center; gap: 7px; padding: 6px 10px; cursor: pointer; list-style: none; font-size: 10.5px; line-height: 1.8; }
.dsh-tool-head::-webkit-details-marker { display: none; }
.dsh-tool-dot { flex: 0 0 auto; width: 6px; height: 6px; border-radius: 50%; background: var(--green); }
.dsh-tool.running .dsh-tool-dot { background: var(--blue); animation: dsh-pulse 1s ease-in-out infinite; }
.dsh-tool.failed .dsh-tool-dot { background: var(--red); }
.dsh-tool-title { flex: 0 0 auto; color: var(--blue); font-weight: 500; }
.dsh-tool-sep { flex: 0 0 auto; width: 3px; height: 3px; border-radius: 50%; background: var(--text-faint); }
.dsh-tool-desc { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-faint); font-family: ui-monospace, Menlo, monospace; font-size: 10px; }
.dsh-tool-chevron { flex: 0 0 auto; color: var(--text-faint); }
.dsh-tool[open] .dsh-tool-chevron { transform: rotate(90deg); }
.dsh-tool-chevron svg { transition: transform 0.12s ease; display: block; }
.dsh-tool-detail { border-top: 1px solid var(--line); padding: 2px 0; }
.dsh-io-card { border: 1px solid var(--line); border-radius: 10px; background: #fafbfc; margin: 6px 8px; overflow: hidden; }
.dsh-io-section { display: grid; grid-template-columns: max-content 1fr; align-items: baseline; column-gap: 14px; max-height: 240px; overflow: auto; padding: 9px 12px; }
.dsh-io-label { position: sticky; top: 0; align-self: start; color: var(--text-faint); font-size: 9.5px; }
.dsh-io-divider { height: 1px; flex: none; background: var(--line); }
.dsh-io-text { margin: 0; min-width: 0; color: var(--text-soft); font-family: ui-monospace, Menlo, monospace; font-size: 9.5px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; overflow-wrap: anywhere; }
.dsh-io-text.error { color: var(--red); }
.dsh-subagent { display: flex; align-items: center; justify-content: space-between; gap: 8px; max-width: 92%; margin-bottom: 8px; padding: 7px 9px; border: 1px solid #d8c9f1; border-radius: 8px; background: #f8f3ff; color: #7351a6; font-size: 9.5px; }
.dsh-subagent.failed { border-color: #e6b5b8; background: var(--red-soft); color: var(--red); }
.dsh-subagent.done { border-color: #b7dfc8; background: var(--green-soft); color: var(--green); }
.dsh-subagent-id { font-family: ui-monospace, Menlo, monospace; font-size: 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dsh-timeline .timeline-item { border-left: 1px solid var(--line); }

.session-surface #dsh-settings,
.session-surface #dsh-close { display: none; }
.desktop-surface .dsh-panel { display: none; width: 100%; height: 100svh; border: 0; border-radius: 0; box-shadow: none; }
.desktop-surface.dsh-open .dsh-panel { display: flex; }
.desktop-surface.dsh-open .activity-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 400px);
  min-height: 100svh;
  padding: 0;
  gap: 0;
}
.desktop-surface.dsh-open .dsh-panel { grid-column: 1; border-right: 1px solid var(--line); }
.desktop-surface.dsh-open .monitor-panel,
.desktop-surface.dsh-open #task-drawer,
.desktop-surface.dsh-open .source-drawer,
.desktop-surface.dsh-open .skill-drawer,
.desktop-surface.dsh-open .history-drawer { grid-column: 2; }
.desktop-surface .dsh-header { min-height: 42px; flex-basis: 42px; padding: 0 10px 0 84px; }

/* 独立会话窗口只有会话面板，不应沿用主窗口的双栏网格。 */
.desktop-surface.session-surface.dsh-open .activity-workspace {
  display: block;
  min-height: 100svh;
  padding: 0;
}
.desktop-surface.session-surface.dsh-open #dsh-panel {
  display: flex;
  width: 100%;
  height: 100svh;
}

@media (max-width: 1180px) {
  body:not(.desktop-surface).dsh-open .activity-workspace {
    grid-template-columns: minmax(300px, 1fr) minmax(320px, 1fr);
  }
  body:not(.desktop-surface).dsh-open #task-drawer { display: none; }
}

/* 设置对话框 */
.settings-target { display: flex; align-items: center; gap: 6px; margin: -4px 0 12px; padding: 0 8px; color: var(--text-soft); font-size: 10px; }
.settings-target-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green, #0e9f5b); }
.settings-note { margin: 0 0 12px; padding: 7px 10px; border-radius: 7px; background: #eef1ff; color: #2c48c9; font-size: 10.5px; }
.settings-hint { display: block; color: var(--text-faint); font-size: 10px; line-height: 15px; }
.settings-pair { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 12px 0; padding: 14px; border: 1px solid var(--line); border-radius: 10px; }
.settings-pair-code { margin: 6px 0 2px; font-family: ui-monospace, monospace; font-size: 24px; font-weight: 650; letter-spacing: 3px; }
.settings-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.settings-table th, .settings-table td { padding: 7px 6px; border-bottom: 1px solid var(--line); text-align: left; }
.settings-table th { color: var(--text-faint); font-weight: 500; font-size: 10px; }
.command-button.small { padding: 3px 9px; font-size: 10px; }
.settings-subtitle { margin: 18px 0 6px; font-size: 11.5px; font-weight: 650; }
.settings-table select, .settings-table input[type="number"] { max-width: 150px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; font-size: 10.5px; background: var(--surface); }
.settings-table input[type="number"] { width: 100px; }
.settings-num { font-family: ui-monospace, monospace; font-size: 10.5px; color: var(--text-soft); white-space: nowrap; }
.settings-bar { display: inline-block; width: 60px; height: 5px; border-radius: 999px; background: var(--surface-soft); overflow: hidden; vertical-align: middle; border: 1px solid var(--line); }
.settings-bar i { display: block; height: 100%; background: var(--blue); }
.settings-bar i.hi { background: #b26b00; }
.settings-warn-text { color: #b26b00; font-size: 10px; }
.settings-kv { display: grid; grid-template-columns: 90px 1fr; gap: 12px 12px; align-items: start; font-size: 11px; }
.settings-kv > span:nth-child(odd) { color: var(--text-soft); padding-top: 4px; }
.settings-kv input[type="number"], .settings-kv input[type="time"] { width: 70px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; font-size: 11px; }
.settings-kv input[type="time"] { width: 100px; }
.settings-check { display: inline-flex; align-items: center; gap: 5px; }
.settings-inline { display: inline-flex; gap: 6px; align-items: center; margin-left: 6px; }
#settings-digest-chips { display: inline-flex; gap: 5px; flex-wrap: wrap; }

.settings-dialog {
  width: min(720px, calc(100vw - 32px));
  height: 560px;
  max-height: calc(100vh - 40px);
  max-height: calc(100svh - 40px);
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.settings-dialog::backdrop { background: rgba(32, 36, 43, 0.22); backdrop-filter: blur(2px); }
.settings-form { display: grid; grid-template-columns: 168px minmax(0, 1fr); height: 100%; min-height: 0; }
.settings-nav { display: flex; flex-direction: column; gap: 2px; padding: 12px 8px; border-right: 1px solid var(--line); background: var(--surface-soft); }
.settings-brand { padding: 4px 8px 12px; font-size: 12px; }
.settings-nav-item { padding: 8px 10px; border: 0; border-radius: 7px; background: transparent; color: var(--text-soft); cursor: pointer; font-size: 11.5px; text-align: left; }
.settings-nav-item:hover { background: var(--surface); color: var(--text); }
.settings-nav-item.active { background: var(--surface-blue); color: #315ed4; font-weight: 650; }
.settings-content { display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100%; overflow: hidden; }
.settings-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.settings-head h2 { margin: 0; font-size: 13px; }
.settings-scroll { flex: 1; min-height: 0; overflow: auto; padding: 14px; }
.settings-section { display: none; }
.settings-section.active { display: block; }
.settings-field { display: grid; grid-template-columns: 96px minmax(0, 1fr); align-items: center; gap: 10px; margin-bottom: 11px; }
.settings-field > span { color: var(--text-soft); font-size: 10.5px; }
.settings-field input,
.settings-field select { width: 100%; height: 30px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: 6px; outline: none; font-size: 10.5px; }
.settings-field input:focus,
.settings-field select:focus { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(77, 107, 254, 0.1); }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 11px; }
.settings-row > span { color: var(--text-faint); }
.settings-row code { color: var(--text-soft); font-family: ui-monospace, Menlo, monospace; font-size: 9.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.settings-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--line); }

/* dsh 会话栏与输入区 */
.dsh-body { flex: 1; min-height: 0; display: flex; }
.dsh-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dsh-rail { width: 232px; flex: none; display: flex; flex-direction: column; border-right: 1px solid var(--line); background: var(--surface-soft); }
.dsh-rail-new { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 12px 12px 6px; height: 34px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); color: var(--text); font-size: 12px; font-weight: 550; cursor: pointer; }
.dsh-rail-new:hover { background: var(--surface-soft); }
.dsh-rail-new svg { width: 15px; height: 15px; color: var(--text-soft); }
.dsh-rail-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 12px 12px 6px 14px; }
.dsh-rail-title { color: var(--text-faint); font-size: 11.5px; font-weight: 400; }
.dsh-rail-actions { display: inline-flex; flex: none; align-items: center; gap: 4px; opacity: 0; transition: opacity 0.12s ease; }
.dsh-rail-head .dsh-rail-actions,
.dsh-project:hover .dsh-rail-actions,
.dsh-session-item:hover .dsh-rail-actions,
.dsh-session-item.active .dsh-rail-actions { opacity: 1; }
.dsh-rail-action { width: 22px; height: 22px; display: inline-grid; place-items: center; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--text-soft); cursor: pointer; }
.dsh-rail-action:hover { background: var(--surface-soft); color: var(--text); }
.dsh-rail-action svg { width: 15px; height: 15px; }
.dsh-rail-search { padding: 2px 8px 4px; }
.dsh-rail-search input { width: 100%; height: 30px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 8px; outline: none; font-size: 12px; }
.dsh-rail-footer { flex: none; padding: 0; }
.dsh-rail-footer-button { display: flex; align-items: center; gap: 10px; width: 100%; height: 46px; padding: 0 18px; border: 0; border-radius: 0; background: transparent; color: var(--text-soft); font-size: 12.5px; text-align: left; cursor: pointer; }
.dsh-rail-footer-button:hover { background: var(--surface); color: var(--text); }
.dsh-rail-footer-button svg { width: 16px; height: 16px; }
.dsh-project-list { flex: 1; min-height: 0; overflow: auto; padding: 0 6px 8px; display: flex; flex-direction: column; }
.dsh-project-list > * { flex: none; }
.dsh-project { display: flex; align-items: center; gap: 2px; padding: 2px 6px; border-radius: 8px; }
.dsh-project:hover { background: var(--surface); }
.dsh-project-toggle { display: flex; flex: 1; min-width: 0; align-items: center; gap: 8px; height: 30px; padding: 0 6px; border: 0; background: transparent; color: var(--text); cursor: pointer; font-size: 12.5px; font-weight: 400; text-align: left; }
.dsh-project-toggle svg { width: 16px; height: 16px; flex: none; color: var(--blue); }
.dsh-project-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dsh-project-add { width: 22px; height: 22px; display: inline-grid; flex: none; place-items: center; padding: 0; border: 0; border-radius: 5px; background: transparent; color: var(--text-soft); cursor: pointer; }
.dsh-project-add:hover { background: var(--surface-blue); color: var(--blue); }
.dsh-project-add svg { width: 13px; height: 13px; }
.dsh-session-item {
  position: relative; display: flex; align-items: center;
  width: 100%; padding: 0 6px; border-radius: 8px; background: transparent;
}
.dsh-session-item:hover { background: var(--surface); }
.dsh-session-item.active { background: #ededf0; }
.dsh-session-item > .dsh-rail-actions { position: absolute; right: 6px; padding-left: 10px; background: inherit; }
.dsh-session-item:hover .dsh-session-time { opacity: 0; }
.dsh-session-main { display: grid; grid-template-columns: minmax(0, 1fr) max-content; gap: 8px; align-items: center; width: 100%; height: 32px; padding: 0 26px 0 30px; border: 0; background: transparent; text-align: left; cursor: pointer; }
.dsh-session-title { overflow: hidden; color: var(--text); font-size: 12.5px; font-weight: 400; text-overflow: ellipsis; white-space: nowrap; }
.dsh-session-time { flex: none; color: var(--text-faint); font-size: 10.5px; }
.dsh-menu { position: fixed; z-index: 60; min-width: 148px; padding: 4px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); box-shadow: 0 10px 28px rgba(15, 23, 42, 0.16); }
.dsh-menu-item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px; border: 0; border-radius: 6px; background: transparent; color: var(--text); font-size: 10.5px; text-align: left; cursor: pointer; }
.dsh-menu-item:hover { background: var(--surface-soft); }
.dsh-menu-item.danger { color: var(--red); }
.dsh-menu-item.danger:hover { background: var(--red-soft); }
.dsh-menu-item svg { width: 13px; height: 13px; }
.dsh-dialog { width: 320px; padding: 0; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface); color: var(--text); }
.dsh-dialog::backdrop { background: rgba(15, 23, 42, 0.28); }
.dsh-dialog-form { padding: 16px; }
.dsh-dialog-form h3 { margin: 0 0 6px; font-size: 12px; }
.dsh-dialog-form p { margin: 0 0 10px; color: var(--text-soft); font-size: 10.5px; line-height: 1.6; }
.dsh-dialog-input { width: 100%; height: 30px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: 6px; outline: none; font-size: 11px; }
.dsh-dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.dsh-composer-controls { display: flex; align-items: center; gap: 10px; margin-bottom: 7px; }
.dsh-reasoning { display: inline-flex; align-items: center; gap: 5px; color: var(--text-faint); font-size: 9px; }
.dsh-reasoning select { height: 24px; padding: 0 6px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); color: var(--text-soft); font-size: 9.5px; }
.dsh-attachments { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 7px; }
.dsh-attachment { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border: 1px solid #c9d5ff; border-radius: 6px; background: var(--blue-soft); color: #315ed4; font-size: 9.5px; }

.settings-inline { display: flex; gap: 6px; align-items: center; }
.settings-desc { margin: 0 0 12px; color: var(--text-soft); font-size: 10.5px; line-height: 16px; }
.settings-card { padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.settings-card + .settings-card { margin-top: 12px; }
.settings-card .settings-field { grid-template-columns: 1fr; gap: 6px; margin-bottom: 12px; }
.settings-card .settings-field:last-child { margin-bottom: 0; }
.settings-hint { margin: -6px 0 12px; color: var(--text-faint); font-size: 9.5px; }
.segmented { display: inline-flex; padding: 2px; margin-bottom: 14px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface-soft); }
.segmented-item { padding: 5px 12px; border: 0; border-radius: 6px; background: transparent; color: var(--text-soft); font-size: 10.5px; font-weight: 650; cursor: pointer; }
.segmented-item.active { background: white; color: var(--text); box-shadow: 0 1px 2px rgba(20, 24, 33, 0.08); }
.settings-advanced { margin: 2px 0 12px; }
.settings-advanced > summary { color: var(--text-soft); font-size: 10.5px; cursor: pointer; list-style: none; }
.settings-advanced > summary::-webkit-details-marker { display: none; }
.settings-advanced > summary::before { content: '›'; display: inline-block; margin-right: 6px; transition: transform 0.15s; }
.settings-advanced[open] > summary::before { transform: rotate(90deg); }
.settings-advanced-body { padding-top: 12px; }

/* 模型目录 */
.settings-group { border: 1px solid var(--line-strong); border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; }
.settings-group-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; }
.settings-group-head > span:first-child { color: var(--text-strong, var(--text)); font-size: 10.5px; font-weight: 600; }
.settings-link { background: none; border: none; padding: 0; color: var(--blue); font-size: 10.5px; cursor: pointer; }
.settings-link:disabled { opacity: 0.5; cursor: default; }
.settings-search { width: 100%; height: 28px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: 6px; outline: none; font-size: 10.5px; margin-bottom: 8px; background: transparent; color: var(--text); }
.settings-search:focus { border-color: var(--blue); }
.model-list { display: grid; gap: 8px; margin-bottom: 9px; }
.model-item { border: 1px solid var(--line); border-radius: 7px; padding: 8px 10px; display: grid; gap: 7px; }
.model-item-head { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto auto; gap: 7px; align-items: center; }
.model-item-head input { min-width: 0; height: 28px; padding: 0 7px; border: 1px solid var(--line-strong); border-radius: 6px; outline: none; font-size: 10.5px; background: transparent; color: var(--text); }
.model-item-head input:focus { border-color: var(--blue); }
.model-vision { display: inline-flex; align-items: center; gap: 4px; color: var(--text-soft); font-size: 10.5px; white-space: nowrap; cursor: pointer; }
.model-remove { width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--line-strong); background: none; color: var(--text-soft); font-size: 12px; line-height: 1; cursor: pointer; }
.model-remove:hover { border-color: #e5636d; color: #e5636d; }
.model-item-row { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.model-item-row label,
.model-levels { display: grid; gap: 4px; color: var(--text-soft); font-size: 9.5px; }
.model-item-row input,
.model-levels input { height: 28px; padding: 0 7px; border: 1px solid var(--line-strong); border-radius: 6px; outline: none; font-size: 10.5px; background: transparent; color: var(--text); }
.model-item-row input:focus,
.model-levels input:focus { border-color: var(--blue); }
.model-levels small { color: var(--text-faint, var(--text-soft)); font-size: 9px; }
.settings-inline select { flex: 1; min-width: 0; }
.settings-test { margin-top: 2px; }
.settings-status { display: inline-flex; align-items: center; gap: 5px; color: var(--text-faint); font-size: 10px; }
.settings-status i { width: 7px; height: 7px; border-radius: 50%; background: var(--text-faint); }
.settings-status.ok i { background: var(--green); }
.settings-status.testing i { background: var(--blue); }
.settings-status.error i { background: var(--red); }
.settings-mode-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.settings-mode { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); text-align: left; cursor: pointer; }
.settings-mode:hover { background: var(--surface-soft); }
.settings-mode.active { border-color: #b9c8ff; background: var(--surface-blue); }
.settings-mode .radio { width: 15px; height: 15px; margin-top: 1px; flex: none; border: 1.5px solid var(--line-strong); border-radius: 50%; }
.settings-mode.active .radio { border-color: var(--blue); box-shadow: inset 0 0 0 3px var(--surface), inset 0 0 0 10px var(--blue); }
.settings-mode strong { display: block; font-size: 11px; }
.settings-mode small { display: block; margin-top: 2px; color: var(--text-faint); font-size: 9.5px; line-height: 1.5; }
.settings-mode.danger strong,
.settings-mode.danger small { color: var(--orange); }
.settings-mode.danger.active { border-color: #efd29a; background: var(--orange-soft); }

.settings-inline input { flex: 1; min-width: 0; height: 30px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: 6px; outline: none; font-size: 10.5px; }

.settings-status.warn i { background: var(--orange); }

.dsh-tool-state { flex: 0 0 auto; color: var(--text-faint); font-size: 9px; }
.dsh-tool-state.running { color: var(--blue); }
.dsh-tool-state.failed { color: var(--red); }
.md-code { margin: 8px 0; border: 1px solid var(--line); border-radius: 8px; background: #f8f9fb; overflow: hidden; }
.md-code-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 8px 4px 10px; border-bottom: 1px solid var(--line); color: var(--text-faint); font-size: 9px; }
.md-code-copy { border: 0; background: transparent; color: var(--text-faint); font-size: 9px; cursor: pointer; }
.md-code-copy:hover { color: var(--blue); }
.md-code pre { margin: 0; padding: 8px 10px; max-height: 340px; overflow: auto; }
.md-code code { padding: 0; background: transparent; font-family: ui-monospace, Menlo, monospace; font-size: 10px; line-height: 1.55; }
.message-body code { padding: 1px 4px; border-radius: 4px; background: #eef1f5; font-family: ui-monospace, Menlo, monospace; font-size: 10px; }
.md-code code { padding: 0; background: transparent; }
.message-body strong { font-weight: 700; }
.message-body h1,
.message-body h2,
.message-body h3 { margin: 8px 0 4px; font-size: 12px; }
.message-body .md-li { margin: 2px 0; }

#settings-purposes .settings-table td:first-child { min-width: 96px; white-space: nowrap; }
#settings-purposes .settings-table td:first-child .settings-hint { white-space: normal; }
.settings-kv .settings-inline input[type="time"] { width: 110px; flex: none; }
.settings-kv .settings-inline { display: inline-flex; width: auto; }
#settings-purposes .settings-table { table-layout: fixed; }
#settings-purposes .settings-table th:nth-child(1) { width: 96px; }
#settings-purposes .settings-table th:nth-child(4) { width: 104px; }
#settings-purposes .settings-table th:nth-child(5) { width: 96px; }
#settings-purposes .settings-table select { width: 100%; max-width: none; }
#settings-purposes .settings-table input[type="number"] { width: 92px; }
#settings-purposes .settings-table td b { display: block; }
#settings-purposes .settings-bar { width: 40px; }

.sc-impact { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.sc-kpi { padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-soft); }
.sc-kpi b { display: block; font-size: 13px; }
.sc-kpi span { color: var(--text-faint); font-size: 9px; }

.settings-remote-form { display: grid; grid-template-columns: 1fr 160px auto; gap: 8px; align-items: end; margin-top: 8px; }
.settings-remote-form label { display: grid; gap: 4px; font-size: 10.5px; color: var(--text-soft); }
.settings-remote-form input { padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; font-size: 11px; }
#settings-remote-error { color: var(--red); min-height: 14px; }
.settings-target.remote .settings-target-dot { background: var(--blue); }
