:root {
  --tt-bg: #f5f6f7;
  --tt-panel: #ffffff;
  --tt-soft: #f8f9fa;
  --tt-ink: #1f2a32;
  --tt-muted: #64717b;
  --tt-line: rgba(31, 42, 50, 0.12);
  --tt-accent: #a83a1a;
  --tt-accent-soft: #fff0eb;
  --tt-blue: #2563eb;
  --tt-teal: #0f766e;
  --tt-gold: #b7791f;
  --tt-green: #15803d;
  --tt-purple: #7c3aed;
  --tt-shadow: 0 14px 38px rgba(25, 34, 42, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--tt-bg);
}

body.task-tree-page {
  overflow: hidden;
  min-width: 320px;
  margin: 0;
  background: var(--tt-bg);
  color: var(--tt-ink);
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  line-height: 1.5;
}

.task-tree-page a {
  color: inherit;
}

body.task-tree-page.takefu-shell-ready::before {
  display: none;
}

body.task-tree-page .takefu-shell-header {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
}

body.task-tree-page .takefu-api-bottom-ad,
body.task-tree-page .takefu-api-side-ad,
body.task-tree-page .takefu-shell-footer,
body.task-tree-page .takefu-backtop {
  display: none !important;
}

.task-tree-shell {
  position: fixed;
  inset: 68px 0 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  width: 100%;
  height: calc(100vh - 68px);
  margin: 0;
  padding: 0;
  overflow: hidden;
}

.task-tree-toolbar {
  display: grid;
  grid-template-columns: minmax(168px, 0.32fr) minmax(286px, 0.48fr) minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
  min-width: 0;
  padding: 10px 12px;
  border-bottom: 1px solid var(--tt-line);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 26px rgba(25, 34, 42, 0.08);
  backdrop-filter: blur(14px);
}

.task-tree-titlebar {
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--tt-line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(200, 58, 29, 0.07), transparent 42%),
    linear-gradient(180deg, #ffffff 0%, #fbfbfc 100%);
  box-shadow: var(--tt-shadow);
}

.task-tree-kicker {
  display: inline-flex;
  margin-bottom: 3px;
  color: var(--tt-accent);
  font-size: 11px;
  font-weight: 900;
}

.task-tree-titlebar h1 {
  margin: 0;
  color: #17212a;
  font-size: 24px;
  font-weight: 950;
  letter-spacing: 0;
  line-height: 1.15;
}

.task-tree-titlebar__note {
  margin: 6px 0 0;
  color: var(--tt-muted);
  font-size: 12px;
  font-weight: 850;
  line-height: 1.35;
}

.task-tree-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.task-tree-stats div {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--tt-line);
  border-radius: 8px;
  background: var(--tt-panel);
  box-shadow: 0 10px 26px rgba(25, 34, 42, 0.05);
}

.task-tree-stats dt {
  margin: 0 0 4px;
  color: var(--tt-muted);
  font-size: 12px;
  font-weight: 800;
}

.task-tree-stats dd {
  margin: 0;
  color: #14202a;
  font-size: 20px;
  font-weight: 950;
  line-height: 1.1;
}

.task-tree-controls {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: end;
  gap: 8px;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--tt-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 12px 30px rgba(25, 34, 42, 0.08);
  backdrop-filter: blur(14px);
}

.task-tree-search,
.task-tree-select {
  display: grid;
  gap: 4px;
  flex: 0 0 auto;
  min-width: 0;
}

.task-tree-search {
  width: clamp(210px, 24vw, 320px);
}

.task-tree-select {
  width: 146px;
}

.task-tree-search span,
.task-tree-select span {
  color: var(--tt-muted);
  font-size: 11px;
  font-weight: 900;
}

.task-tree-search input,
.task-tree-select select {
  width: 100%;
  height: 36px;
  border: 1px solid rgba(31, 42, 50, 0.14);
  border-radius: 8px;
  background: #f7f8f9;
  color: var(--tt-ink);
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  outline: 0;
}

.task-tree-search input {
  padding: 0 14px;
}

.task-tree-select select {
  padding: 0 36px 0 12px;
}

.task-tree-search input:hover,
.task-tree-search input:focus,
.task-tree-select select:hover,
.task-tree-select select:focus {
  border-color: rgba(200, 58, 29, 0.36);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(200, 58, 29, 0.1);
}

.task-tree-segments,
.task-tree-view-actions,
.task-tree-mobile-view,
.task-tree-plan-actions {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 4px;
  min-height: 36px;
  padding: 4px;
  border: 1px solid rgba(31, 42, 50, 0.1);
  border-radius: 8px;
  background: #f7f8f9;
}

.task-tree-segments button,
.task-tree-view-actions button,
.task-tree-mobile-view button,
.task-tree-plan-actions button,
.task-tree-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 28px;
  padding: 0 11px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #34434c;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.task-tree-segments button,
.task-tree-view-actions button,
.task-tree-mobile-view button,
.task-tree-plan-actions button,
.task-tree-toggle {
  cursor: pointer;
}

.task-tree-segments button:hover,
.task-tree-segments button:focus-visible,
.task-tree-segments button.is-active,
.task-tree-view-actions button:hover,
.task-tree-view-actions button:focus-visible,
.task-tree-mobile-view button:hover,
.task-tree-mobile-view button:focus-visible,
.task-tree-mobile-view button.is-active,
.task-tree-plan-actions button:hover,
.task-tree-plan-actions button:focus-visible {
  color: #fff;
  background: var(--tt-accent);
  outline: 0;
}

.task-tree-mobile-view {
  display: none;
}

.task-tree-plan-actions button {
  gap: 6px;
}

.task-tree-plan-actions span {
  min-width: 22px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(200, 58, 29, 0.12);
  color: var(--tt-accent);
  line-height: 18px;
}

.task-tree-plan-actions button:hover span,
.task-tree-plan-actions button:focus-visible span {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.task-tree-view-actions span {
  min-width: 46px;
  color: var(--tt-muted);
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

.task-tree-toggle {
  gap: 6px;
  flex: 0 0 auto;
  align-self: end;
  height: 36px;
  border: 1px solid rgba(31, 42, 50, 0.1);
  background: #f7f8f9;
}

.task-tree-toggle input {
  width: 15px;
  height: 15px;
  accent-color: var(--tt-accent);
}

.task-tree-traders {
  display: flex;
  gap: 8px;
  min-width: 0;
  padding: 8px 12px;
  overflow-x: auto;
  border-bottom: 1px solid var(--tt-line);
  background: #f7f8f9;
}

.task-tree-traders button {
  display: inline-grid;
  grid-template-columns: 36px max-content;
  gap: 8px;
  align-items: center;
  flex: 0 0 auto;
  min-width: 0;
  height: 48px;
  padding: 5px 10px 5px 5px;
  border: 1px solid rgba(31, 42, 50, 0.12);
  border-radius: 8px;
  background: #fff;
  color: #283741;
  font: inherit;
  font-size: 12px;
  font-weight: 950;
  cursor: pointer;
}

.task-tree-traders button:hover,
.task-tree-traders button:focus-visible,
.task-tree-traders button.is-active {
  border-color: rgba(200, 58, 29, 0.32);
  color: var(--tt-accent);
  background: var(--tt-accent-soft);
  outline: 0;
}

.task-tree-traders button.is-hover-focus {
  border-color: var(--hover-trader-color, var(--tt-accent));
  box-shadow: 0 0 0 3px rgba(200, 58, 29, 0.12);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--hover-trader-color, var(--tt-accent)) 18%, transparent);
}

.task-tree-traders button.is-hover-muted {
  opacity: 0.7;
}

.task-tree-traders img,
.task-tree-traders__all {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: cover;
  background: #eef1f2;
}

.task-tree-traders__all {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--tt-accent);
  color: #fff;
  font-weight: 950;
}

.task-tree-board {
  position: relative;
  overflow: hidden;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: var(--tt-panel);
  box-shadow: var(--tt-shadow);
}

.task-tree-board__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 52px;
  padding: 0 16px;
  border-bottom: 1px solid var(--tt-line);
  background: #fff;
}

.task-tree-board__head > span:first-of-type {
  flex: 1 1 auto;
  min-width: 0;
}

.task-tree-board__head strong {
  color: #17212a;
  font-size: 15px;
  font-weight: 950;
}

.task-tree-board__head span {
  color: var(--tt-muted);
  font-size: 13px;
  font-weight: 700;
}

.task-tree-focus-hint {
  flex: 0 0 auto;
  max-width: min(320px, 45vw);
  overflow: hidden;
  padding: 5px 10px;
  border: 1px solid rgba(200, 58, 29, 0.18);
  border-radius: 999px;
  background: var(--tt-accent-soft);
  color: var(--tt-accent) !important;
  font-size: 12px !important;
  font-weight: 900 !important;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-tree-focus-hint[hidden] {
  display: none;
}

.task-tree-viewport {
  position: relative;
  height: calc(100% - 52px);
  min-height: 0;
  overflow: auto;
  outline: 0;
  background:
    linear-gradient(rgba(31, 42, 50, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31, 42, 50, 0.045) 1px, transparent 1px),
    #f6f7f8;
  background-size: 34px 34px;
  cursor: grab;
  overscroll-behavior: contain;
  touch-action: pan-x pan-y;
}

.task-tree-viewport.is-panning {
  cursor: grabbing;
  user-select: none;
}

.task-tree-viewport:focus-visible {
  box-shadow: inset 0 0 0 3px rgba(200, 58, 29, 0.2);
}

.task-tree-list {
  display: none;
}

.task-tree-progress-summary,
.task-tree-ready-chip {
  flex: 0 0 auto;
}

.task-tree-progress-summary {
  padding: 5px 10px;
  border: 1px solid rgba(21, 128, 61, 0.16);
  border-radius: 999px;
  background: rgba(21, 128, 61, 0.08);
  color: var(--tt-green) !important;
  font-size: 12px !important;
  font-weight: 900 !important;
}

.task-tree-ready-chip {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(200, 58, 29, 0.22);
  border-radius: 999px;
  background: var(--tt-accent-soft);
  color: var(--tt-accent);
  font: inherit;
  font-size: 12px;
  font-weight: 950;
  cursor: pointer;
}

.task-tree-ready-chip:hover,
.task-tree-ready-chip:focus-visible {
  background: var(--tt-accent);
  color: #fff;
  outline: 0;
}

.task-tree-view-actions button:disabled {
  opacity: 0.62;
  cursor: wait;
}

.task-tree-search-results,
.task-tree-ready-panel {
  position: absolute;
  z-index: 18;
  right: 16px;
  top: 64px;
  width: min(460px, calc(100vw - 32px));
  max-height: min(520px, calc(100% - 84px));
  overflow: auto;
  padding: 12px;
  border: 1px solid rgba(31, 42, 50, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 48px rgba(18, 28, 36, 0.18);
}

.task-tree-search-results[hidden],
.task-tree-ready-panel[hidden] {
  display: none;
}

.task-tree-search-results__head,
.task-tree-ready-panel__head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.task-tree-search-results__head strong,
.task-tree-ready-panel__head strong {
  display: block;
  color: #17212a;
  font-size: 15px;
  font-weight: 950;
}

.task-tree-search-results__head span,
.task-tree-ready-panel__head span {
  display: block;
  margin-top: 2px;
  color: var(--tt-muted);
  font-size: 12px;
  font-weight: 750;
}

.task-tree-ready-panel__head button,
.task-tree-ready-panel__actions button {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(31, 42, 50, 0.1);
  border-radius: 6px;
  background: #f7f8f9;
  color: #34434c;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.task-tree-ready-panel__head button:hover,
.task-tree-ready-panel__head button:focus-visible,
.task-tree-ready-panel__actions button:hover,
.task-tree-ready-panel__actions button:focus-visible {
  border-color: rgba(200, 58, 29, 0.3);
  color: var(--tt-accent);
  background: var(--tt-accent-soft);
  outline: 0;
}

.task-tree-search-results__list,
.task-tree-ready-panel__list {
  display: grid;
  gap: 8px;
}

.task-tree-search-results__list button,
.task-tree-plan-item {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(31, 42, 50, 0.1);
  border-color: color-mix(in srgb, var(--node-color, var(--tt-accent)) 62%, #ffffff);
  border-radius: 8px;
  background: color-mix(in srgb, var(--node-color, var(--tt-accent)) 5%, #ffffff);
  color: var(--tt-ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.task-tree-search-results__list button {
  display: grid;
  gap: 3px;
  padding: 10px;
}

.task-tree-search-results__list button:hover,
.task-tree-search-results__list button:focus-visible,
.task-tree-plan-item:hover,
.task-tree-plan-item:focus-visible {
  border-color: rgba(200, 58, 29, 0.34);
  box-shadow: 0 8px 22px rgba(25, 34, 42, 0.1);
  outline: 0;
}

.task-tree-search-results__list strong,
.task-tree-plan-item strong {
  overflow: hidden;
  color: #17212a;
  font-size: 13px;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-tree-search-results__list span,
.task-tree-plan-item span {
  min-width: 0;
}

.task-tree-search-results__list button > span,
.task-tree-plan-item__main > span,
.task-tree-plan-item__status {
  color: var(--tt-muted);
  font-size: 12px;
  font-weight: 750;
}

.task-tree-search-results__more,
.task-tree-ready-panel__more {
  padding: 8px 2px 0;
  color: var(--tt-muted);
  font-size: 12px;
  font-weight: 800;
}

.task-tree-ready-panel__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.task-tree-plan-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
}

.task-tree-plan-item__main {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.task-tree-plan-item__status,
.task-tree-plan-item__check {
  white-space: nowrap;
}

.task-tree-plan-item__check {
  min-height: 28px;
  padding: 0 9px;
  border-radius: 6px;
  background: var(--tt-accent-soft);
  color: var(--tt-accent);
  font-size: 12px;
  font-weight: 900;
  line-height: 28px;
}

.task-tree-plan-item.is-completed {
  opacity: 0.62;
  background: #f5f6f7;
}

.task-tree-plan-item.is-ready:not(.is-completed) {
  background: linear-gradient(90deg, rgba(21, 128, 61, 0.06), #fff 32%);
}

.task-tree-collector-groups {
  display: grid;
  gap: 12px;
}

.task-tree-collector-group {
  padding-top: 10px;
  border-top: 1px solid var(--tt-line);
}

.task-tree-collector-group h4 {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 8px;
  color: #17212a;
  font-size: 13px;
  font-weight: 950;
}

.task-tree-collector-group h4 span {
  color: var(--tt-muted);
}

.task-tree-canvas {
  position: relative;
  min-width: 100%;
  min-height: 100%;
}

.task-tree-scene {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
}

.task-tree-lanes,
.task-tree-edges,
.task-tree-nodes {
  position: absolute;
  inset: 0;
}

.task-tree-lane {
  position: absolute;
  left: 0;
  overflow: hidden;
  border-top: 1px solid rgba(31, 42, 50, 0.1);
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.34));
}

.task-tree-lane:nth-child(2n) {
  background: linear-gradient(90deg, rgba(248, 249, 250, 0.86), rgba(248, 249, 250, 0.38));
}

.task-tree-lane.is-trader-focus {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0.42));
}

.task-tree-lane.is-trader-muted {
  opacity: 0.72;
}

.task-tree-lane__label {
  position: sticky;
  left: 16px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  margin: 8px 0 0 16px;
  padding: 0 12px 0 4px;
  border: 1px solid rgba(31, 42, 50, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  color: #17212a;
  font-size: 13px;
  font-weight: 950;
  white-space: nowrap;
  box-shadow: 0 8px 18px rgba(25, 34, 42, 0.08);
}

/* 泳道色：用小圆点表达，不再使用左侧竖条（视觉硬规则） */
.task-tree-lane__label::before {
  content: "";
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--lane-color, var(--tt-accent));
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.9);
}

.task-tree-lane__label img {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  object-fit: cover;
  background: #eef1f2;
}

.task-tree-lane__label span {
  display: inline-flex;
  margin-left: 2px;
  color: var(--tt-muted);
  font-size: 12px;
  font-weight: 850;
}

.task-tree-edges {
  z-index: 2;
  overflow: visible;
  pointer-events: none;
}

.task-tree-edge {
  fill: none;
  stroke: rgba(92, 103, 112, 0.24);
  stroke: color-mix(in srgb, var(--edge-color, #5c6770) 28%, rgba(92, 103, 112, 0.22));
  stroke-width: 1.8;
  vector-effect: non-scaling-stroke;
}

.task-tree-edge[data-relation="branch"] {
  stroke-dasharray: none;
}

.task-tree-edge[data-relation="conditional"] {
  stroke-dasharray: none;
}

.task-tree-edge[data-relation="cross"] {
  stroke-opacity: 0.44;
}

.task-tree-edge.is-hidden {
  display: none;
}

.task-tree-edge.is-active {
  stroke: var(--edge-color, var(--tt-accent));
  stroke-width: 3;
}

.task-tree-edge.is-chain-before {
  stroke: var(--edge-color, var(--tt-gold));
  stroke-dasharray: none;
  stroke-width: 3;
}

.task-tree-edge.is-chain-after {
  stroke: var(--edge-color, var(--tt-blue));
  stroke-dasharray: none;
  stroke-width: 3;
}

.task-tree-edge.is-trader-focus {
  stroke-opacity: 1;
  stroke-width: 2.4;
}

.task-tree-edge.is-trader-focus[data-relation="branch"],
.task-tree-edge.is-chain-before[data-relation="branch"],
.task-tree-edge.is-chain-after[data-relation="branch"] {
  stroke-dasharray: 10 7;
}

.task-tree-edge.is-trader-focus[data-relation="conditional"],
.task-tree-edge.is-chain-before[data-relation="conditional"],
.task-tree-edge.is-chain-after[data-relation="conditional"] {
  stroke-dasharray: 3 6;
}

.task-tree-edge.is-trader-muted {
  stroke-opacity: 0.26;
}

.task-tree-nodes {
  z-index: 4;
}

.task-tree-node {
  position: absolute;
  display: block;
  width: 190px;
  height: 82px;
  padding: 9px 10px 9px 12px;
  border: 1px solid rgba(31, 42, 50, 0.12);
  border-color: color-mix(in srgb, var(--node-color, var(--tt-accent)) 62%, #ffffff);
  border-radius: 8px;
  background: color-mix(in srgb, var(--node-color, var(--tt-accent)) 5%, #ffffff);
  color: var(--tt-ink);
  font: inherit;
  text-align: left;
  box-shadow: 0 7px 18px rgba(25, 34, 42, 0.08);
  cursor: pointer;
  user-select: none;
  transition: border-color 0.14s ease, box-shadow 0.14s ease, transform 0.14s ease, opacity 0.14s ease;
}

.task-tree-node:hover,
.task-tree-node:focus-visible,
.task-tree-node.is-selected {
  border-color: rgba(200, 58, 29, 0.48);
  box-shadow: 0 12px 26px rgba(25, 34, 42, 0.13);
  outline: 0;
}

.task-tree-node.is-dimmed {
  opacity: 0.22;
}

.task-tree-node.is-chain {
  opacity: 1;
  box-shadow: 0 10px 24px rgba(25, 34, 42, 0.12);
}

.task-tree-node.is-chain-before {
  border-color: rgba(183, 121, 31, 0.55);
  background: linear-gradient(180deg, #fffaf0 0%, #fff 100%);
}

.task-tree-node.is-chain-after {
  border-color: rgba(37, 99, 235, 0.45);
  background: linear-gradient(180deg, #eff6ff 0%, #fff 100%);
}

.task-tree-node.is-completed {
  opacity: 0.5;
  background: #f1f3f4;
  filter: grayscale(0.25);
}

.task-tree-node.is-ready:not(.is-completed) {
  box-shadow: 0 0 0 2px rgba(21, 128, 61, 0.2), 0 7px 18px rgba(25, 34, 42, 0.08);
}

.task-tree-node.is-trader-focus {
  opacity: 1;
  border-color: var(--node-color, var(--tt-accent));
  border-color: color-mix(in srgb, var(--node-color, var(--tt-accent)) 70%, #1f2a32);
  box-shadow: 0 0 0 2px rgba(200, 58, 29, 0.1), 0 10px 22px rgba(25, 34, 42, 0.1);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--node-color, var(--tt-accent)) 14%, transparent), 0 10px 22px rgba(25, 34, 42, 0.1);
}

.task-tree-node.is-trader-muted {
  opacity: 0.56;
}

.task-tree-node.is-hidden {
  display: none;
}

.task-tree-node__body {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.task-tree-node__title {
  display: -webkit-box;
  min-height: 36px;
  overflow: hidden;
  color: #17212a;
  font-size: 13px;
  font-weight: 950;
  line-height: 18px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.task-tree-node__meta,
.task-tree-node__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
}

.task-tree-node__meta span,
.task-tree-node__badges span,
.task-tree-detail__badges span {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 20px;
  padding: 0 6px;
  border: 1px solid rgba(31, 42, 50, 0.08);
  border-radius: 6px;
  background: #f5f6f7;
  color: var(--tt-muted);
  font-size: 11px;
  font-weight: 850;
  line-height: 1.2;
  white-space: nowrap;
}

.task-tree-node__meta span.is-trader {
  border-color: color-mix(in srgb, var(--node-color, var(--tt-accent)) 24%, transparent);
  background: color-mix(in srgb, var(--node-color, var(--tt-accent)) 11%, #fff);
  color: color-mix(in srgb, var(--node-color, var(--tt-accent)) 82%, #1f2a32);
}

.task-tree-node__badges span.is-kappa,
.task-tree-detail__badges span.is-kappa {
  border-color: rgba(200, 58, 29, 0.18);
  background: var(--tt-accent-soft);
  color: var(--tt-accent);
}

.task-tree-node__badges span.is-lightkeeper,
.task-tree-detail__badges span.is-lightkeeper {
  border-color: rgba(37, 99, 235, 0.16);
  background: #eef4ff;
  color: var(--tt-blue);
}

.task-tree-node__badges span.is-collector,
.task-tree-detail__badges span.is-collector {
  border-color: rgba(15, 118, 110, 0.18);
  background: #ecfdf5;
  color: var(--tt-teal);
}

.task-tree-node__badges span.is-branch,
.task-tree-detail__badges span.is-branch,
.task-tree-detail__badges span.is-kappa-route {
  border-color: rgba(183, 121, 31, 0.2);
  background: #fff8e6;
  color: var(--tt-gold);
}

.task-tree-loading,
.task-tree-empty {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 8;
  width: min(360px, calc(100% - 32px));
  padding: 18px;
  border: 1px solid var(--tt-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--tt-muted);
  font-size: 14px;
  font-weight: 900;
  text-align: center;
  box-shadow: var(--tt-shadow);
  transform: translate(-50%, -50%);
}

.task-tree-shell.is-ready .task-tree-loading {
  display: none;
}

.task-tree-minimap {
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: 9;
  width: 218px;
  padding: 8px;
  border: 1px solid rgba(31, 42, 50, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 14px 32px rgba(25, 34, 42, 0.14);
  backdrop-filter: blur(10px);
}

.task-tree-minimap__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
  color: #17212a;
  font-size: 12px;
  font-weight: 950;
}

.task-tree-minimap__head button {
  height: 24px;
  padding: 0 9px;
  border: 1px solid rgba(200, 58, 29, 0.2);
  border-radius: 6px;
  background: var(--tt-accent-soft);
  color: var(--tt-accent);
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.task-tree-minimap__head button:hover,
.task-tree-minimap__head button:focus-visible {
  background: var(--tt-accent);
  color: #fff;
  outline: 0;
}

.task-tree-minimap__body {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1.42;
  overflow: hidden;
  padding: 0;
  border: 1px solid rgba(31, 42, 50, 0.12);
  border-radius: 6px;
  background:
    linear-gradient(rgba(31, 42, 50, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31, 42, 50, 0.055) 1px, transparent 1px),
    #f7f8f9;
  background-size: 18px 18px;
  cursor: crosshair;
}

.task-tree-minimap__body svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.task-tree-minimap__body rect {
  fill: rgba(100, 113, 123, 0.42);
}

.task-tree-minimap__body rect.is-selected {
  fill: var(--tt-accent);
}

.task-tree-minimap__body rect.is-chain-before {
  fill: var(--tt-gold);
}

.task-tree-minimap__body rect.is-chain-after {
  fill: var(--tt-blue);
}

.task-tree-minimap__window {
  position: absolute;
  display: block;
  min-width: 8px;
  min-height: 8px;
  border: 2px solid var(--tt-accent);
  border-radius: 3px;
  background: rgba(200, 58, 29, 0.08);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.88);
  pointer-events: none;
}

.task-tree-list__item {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  width: 100%;
  padding: 12px;
  border: 1px solid rgba(31, 42, 50, 0.12);
  border-color: color-mix(in srgb, var(--node-color, var(--tt-accent)) 62%, #ffffff);
  border-radius: 8px;
  background: color-mix(in srgb, var(--node-color, var(--tt-accent)) 5%, #ffffff);
  color: var(--tt-ink);
  font: inherit;
  text-align: left;
  box-shadow: 0 6px 16px rgba(25, 34, 42, 0.06);
}

.task-tree-list__open {
  display: grid;
  gap: 6px;
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.task-tree-list__item.is-completed {
  opacity: 0.68;
  background: #f4f5f6;
}

.task-tree-list__item.is-ready:not(.is-completed) {
  background: linear-gradient(90deg, rgba(21, 128, 61, 0.06), #fff 42%);
}

.task-tree-list__top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.task-tree-list__item strong {
  overflow: hidden;
  color: #17212a;
  font-size: 14px;
  font-weight: 950;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-tree-list__status {
  padding: 3px 7px;
  border-radius: 999px;
  background: #eef1f2;
  color: var(--tt-muted);
  font-size: 11px;
  font-weight: 950;
  white-space: nowrap;
}

.task-tree-list__item.is-ready:not(.is-completed) .task-tree-list__status {
  background: rgba(21, 128, 61, 0.1);
  color: var(--tt-green);
}

.task-tree-list__item.is-completed .task-tree-list__status {
  background: rgba(82, 82, 91, 0.1);
  color: #52525b;
}

.task-tree-list__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.task-tree-list__meta span {
  display: inline-flex;
  min-height: 21px;
  padding: 0 7px;
  border-radius: 6px;
  background: #f5f6f7;
  color: var(--tt-muted);
  font-size: 11px;
  font-weight: 850;
  line-height: 21px;
}

.task-tree-list__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--tt-muted);
  font-size: 12px;
  font-weight: 800;
}

.task-tree-list__actions > span {
  margin-right: auto;
}

.task-tree-list__actions button {
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid rgba(31, 42, 50, 0.1);
  border-radius: 6px;
  background: #f7f8f9;
  color: #34434c;
  font: inherit;
  font-size: 12px;
  font-weight: 950;
  line-height: 28px;
  cursor: pointer;
}

.task-tree-list__actions [data-progress-action] {
  border-color: rgba(200, 58, 29, 0.18);
  background: var(--tt-accent-soft);
  color: var(--tt-accent);
}

.task-tree-list__actions button:hover,
.task-tree-list__actions button:focus-visible {
  border-color: rgba(200, 58, 29, 0.3);
  color: var(--tt-accent);
  background: var(--tt-accent-soft);
  outline: 0;
}

.task-tree-list__item:hover,
.task-tree-list__item:focus-within,
.task-tree-list__item.is-selected {
  border-color: rgba(200, 58, 29, 0.42);
  box-shadow: 0 10px 24px rgba(25, 34, 42, 0.12);
  outline: 0;
}

.task-tree-empty-inline {
  padding: 18px;
  border: 1px solid var(--tt-line);
  border-radius: 8px;
  background: #fff;
  color: var(--tt-muted);
  font-size: 14px;
  font-weight: 900;
  text-align: center;
}

.task-tree-detail {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  top: 220px;
  z-index: 99970;
  width: min(380px, calc(100vw - 32px));
  max-height: calc(100vh - 244px);
  overflow: auto;
  padding: 16px;
  border: 1px solid rgba(31, 42, 50, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 22px 60px rgba(18, 28, 36, 0.22);
}

@supports selector(:has(*)) {
  .task-tree-shell:has(.task-tree-detail:not([hidden])) .task-tree-minimap {
    right: 416px;
  }
}

@media (min-width: 761px) {
  @supports selector(:has(*)) {
    .task-tree-shell:has(.task-tree-detail:not([hidden])) .task-tree-viewport {
      width: calc(100% - 410px);
    }

    .task-tree-shell:has(.task-tree-detail:not([hidden])) .task-tree-search-results,
    .task-tree-shell:has(.task-tree-detail:not([hidden])) .task-tree-ready-panel {
      right: 426px;
    }
  }
}

.task-tree-detail__close {
  position: sticky;
  top: 0;
  float: right;
  z-index: 2;
  height: 32px;
  padding: 0 10px;
  border: 1px solid rgba(31, 42, 50, 0.1);
  border-radius: 6px;
  background: #f7f8f9;
  color: #34434c;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.task-tree-detail__close:hover,
.task-tree-detail__close:focus-visible {
  color: #fff;
  background: var(--tt-accent);
  outline: 0;
}

.task-tree-detail__head {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding-right: 64px;
}

.task-tree-detail__head img {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  object-fit: cover;
  background: #eef1f2;
}

.task-tree-detail__head span {
  color: var(--tt-accent);
  font-size: 12px;
  font-weight: 900;
}

.task-tree-detail__head h2 {
  margin: 4px 0;
  color: #17212a;
  font-size: 20px;
  font-weight: 950;
  line-height: 1.22;
}

.task-tree-detail__head p {
  margin: 0;
  color: var(--tt-muted);
  font-size: 13px;
  font-weight: 750;
}

.task-tree-detail__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 14px 0;
}

.task-tree-detail__progress {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 12px 0 0;
  padding: 10px;
  border: 1px solid rgba(31, 42, 50, 0.1);
  border-radius: 8px;
  background: #f7f8f9;
}

.task-tree-detail__progress > span {
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 950;
  line-height: 26px;
}

.task-tree-detail__progress > span.is-done {
  background: rgba(82, 82, 91, 0.12);
  color: #52525b;
}

.task-tree-detail__progress > span.is-ready {
  background: rgba(21, 128, 61, 0.1);
  color: var(--tt-green);
}

.task-tree-detail__progress > span.is-blocked {
  background: rgba(183, 121, 31, 0.12);
  color: var(--tt-gold);
}

.task-tree-detail__progress button {
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid rgba(200, 58, 29, 0.18);
  border-radius: 6px;
  background: var(--tt-accent-soft);
  color: var(--tt-accent);
  font: inherit;
  font-size: 12px;
  font-weight: 950;
  cursor: pointer;
}

.task-tree-detail__progress button:hover,
.task-tree-detail__progress button:focus-visible {
  background: var(--tt-accent);
  color: #fff;
  outline: 0;
}

.task-tree-detail__progress small {
  flex: 1 1 100%;
  color: var(--tt-muted);
  font-size: 12px;
  font-weight: 750;
}

.task-tree-detail__note {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  padding: 10px;
  border: 1px solid rgba(183, 121, 31, 0.18);
  border-radius: 8px;
  background: #fffaf0;
  color: #6b4b14;
  font-size: 12px;
  font-weight: 800;
}

.task-tree-detail__note[hidden] {
  display: none;
}

.task-tree-detail__note p {
  margin: 0;
}

.task-tree-detail__section {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--tt-line);
}

.task-tree-detail__section h3 {
  margin: 0 0 10px;
  color: #17212a;
  font-size: 14px;
  font-weight: 950;
}

.task-tree-detail__section ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.task-tree-detail__section li {
  padding: 9px 10px;
  border-radius: 8px;
  background: #f7f8f9;
  color: #34434c;
  font-size: 13px;
  font-weight: 750;
}

.task-tree-detail__links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.task-tree-detail__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex: 1 1 100%;
  width: 100%;
}

.task-tree-detail__toolbar strong {
  color: #17212a;
  font-size: 13px;
  font-weight: 950;
}

.task-tree-detail__links button,
.task-tree-detail__toolbar button {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid rgba(31, 42, 50, 0.1);
  border-radius: 6px;
  background: #f7f8f9;
  color: #34434c;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.task-tree-detail__links button:hover,
.task-tree-detail__links button:focus-visible,
.task-tree-detail__toolbar button:hover,
.task-tree-detail__toolbar button:focus-visible {
  border-color: rgba(200, 58, 29, 0.3);
  color: var(--tt-accent);
  background: var(--tt-accent-soft);
  outline: 0;
}

.task-tree-detail__group {
  flex: 1 1 100%;
  width: 100%;
  padding-top: 10px;
  border-top: 1px solid var(--tt-line);
}

.task-tree-detail__group h4 {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 8px;
  color: #17212a;
  font-size: 13px;
  font-weight: 950;
}

.task-tree-detail__group h4 span {
  color: var(--tt-muted);
}

.task-tree-detail__external {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border: 1px dashed rgba(100, 113, 123, 0.28);
  border-radius: 6px;
  background: #f7f8f9;
  color: var(--tt-muted);
  font-size: 12px;
  font-weight: 850;
}

.task-tree-detail__empty {
  color: var(--tt-muted);
  font-size: 13px;
  font-weight: 750;
}

.task-tree-detail__primary {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  margin-top: 16px;
  border-radius: 8px;
  background: var(--tt-accent);
  color: #fff;
  font-size: 14px;
  font-weight: 950;
  text-decoration: none;
}

.task-tree-detail__primary:hover,
.task-tree-detail__primary:focus-visible {
  background: #a82f18;
  outline: 0;
}

@media (max-width: 1180px) {
  .task-tree-toolbar {
    grid-template-columns: minmax(170px, 0.4fr) minmax(0, 1fr);
  }

  .task-tree-controls {
    grid-column: 1 / -1;
  }

  .task-tree-segments,
  .task-tree-view-actions,
  .task-tree-mobile-view,
  .task-tree-plan-actions,
  .task-tree-toggle {
    justify-self: stretch;
  }

  .task-tree-segments,
  .task-tree-view-actions,
  .task-tree-mobile-view,
  .task-tree-plan-actions {
    justify-content: center;
  }
}

@media (max-width: 760px) {
  body.task-tree-page {
    overflow: auto;
  }

  .task-tree-shell {
    inset: 58px 0 0;
    height: calc(100vh - 58px);
  }

  .task-tree-toolbar {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: 6px 8px;
  }

  .task-tree-shell {
    width: 100%;
  }

  /* 2026-10-19：移动端原为 display:none，导致页面 h1 在 390 视口高 0（屏幕阅读器
     拿不到主标题，也被审计判为 h1 不可见）。改为视觉隐藏但保留语义。 */
  .task-tree-titlebar {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
  }

  .task-tree-stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }

  .task-tree-stats div {
    min-height: 48px;
    padding: 7px 8px;
  }

  .task-tree-stats dt {
    margin-bottom: 1px;
    font-size: 10px;
  }

  .task-tree-stats dd {
    font-size: 17px;
  }

  .task-tree-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 7px;
    overflow: visible;
  }

  .task-tree-search,
  .task-tree-select {
    width: 100%;
  }

  .task-tree-search {
    grid-column: 1 / -1;
  }

  .task-tree-segments,
  .task-tree-view-actions,
  .task-tree-mobile-view,
  .task-tree-plan-actions,
  .task-tree-toggle {
    justify-content: center;
    width: 100%;
  }

  .task-tree-segments,
  .task-tree-plan-actions,
  .task-tree-view-actions,
  .task-tree-mobile-view,
  .task-tree-toggle {
    grid-column: 1 / -1;
  }

  .task-tree-segments button,
  .task-tree-view-actions button,
  .task-tree-mobile-view button,
  .task-tree-plan-actions button {
    min-width: 0;
    padding: 0 8px;
    font-size: 11px;
  }

  .task-tree-mobile-view {
    display: inline-flex;
  }

  .task-tree-toggle {
    display: inline-flex;
    min-height: 34px;
    height: 34px;
  }

  .task-tree-search input,
  .task-tree-select select {
    height: 34px;
  }

  .task-tree-search span,
  .task-tree-select span {
    font-size: 10px;
  }

  .task-tree-traders {
    padding: 6px 8px;
  }

  .task-tree-traders button {
    grid-template-columns: 32px max-content;
    height: 42px;
  }

  .task-tree-traders img,
  .task-tree-traders__all {
    width: 32px;
    height: 32px;
  }

  .task-tree-board__head {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: start;
    min-height: 0;
    padding: 9px 10px;
    gap: 6px;
  }

  .task-tree-board__head > span:first-of-type {
    display: none;
  }

  .task-tree-progress-summary,
  .task-tree-ready-chip {
    justify-self: start;
  }

  .task-tree-focus-hint {
    max-width: 100%;
  }

  .task-tree-viewport {
    height: calc(100% - 52px);
    min-height: 0;
  }

  .task-tree-minimap {
    display: none;
  }

  body:not(.task-tree-list-mode) .task-tree-list {
    display: none;
  }

  body.task-tree-list-mode .task-tree-viewport {
    display: none;
  }

  body.task-tree-list-mode .task-tree-list {
    display: grid;
    gap: 8px;
    height: calc(100% - 52px);
    overflow: auto;
    padding: 10px;
    background: #f6f7f8;
  }

  .task-tree-search-results,
  .task-tree-ready-panel {
    right: 8px;
    left: 8px;
    top: 56px;
    width: auto;
    max-height: min(54vh, calc(100% - 70px));
    padding: 10px;
  }

  .task-tree-search-results__head,
  .task-tree-ready-panel__head {
    display: grid;
  }

  .task-tree-plan-item {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .task-tree-plan-item__status {
    grid-column: 1 / -1;
  }

  .task-tree-detail {
    right: 8px;
    left: 8px;
    top: auto;
    bottom: 8px;
    width: auto;
    max-height: 72vh;
  }
}

@media (prefers-reduced-motion: reduce) {
  .task-tree-node {
    transition: none;
  }
}
