:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --panel: #ffffff;
  --ink: #101828;
  --muted: #667085;
  --line: #d0d5dd;
  --blue: #2563eb;
  --blue-weak: #dbeafe;
  --green: #15803d;
  --green-weak: #dcfce7;
  --amber: #b45309;
  --amber-weak: #fef3c7;
  --red: #b42318;
  --red-weak: #fee4e2;
  --violet: #6d28d9;
  --violet-weak: #ede9fe;
  --teal: #0f766e;
  --teal-weak: #ccfbf1;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 1180px;
  background: var(--bg);
  color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", Arial, sans-serif;
  font-size: 14px;
}

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

button,
.file-btn {
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
  cursor: pointer;
  white-space: nowrap;
}

button:hover,
.file-btn:hover {
  border-color: #98a2b3;
  background: #f9fafb;
}

.primary {
  border-color: #1d4ed8;
  background: #1d4ed8;
  color: #fff;
}

.primary:hover {
  background: #1e40af;
}

.ghost {
  background: #f8fafc;
}

.danger {
  border-color: #fda29b;
  background: var(--red-weak);
  color: var(--red);
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

body.readonly .primary {
  border-color: #98a2b3;
  background: #f2f4f7;
  color: #475467;
}

.icon-btn {
  height: 30px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  height: 66px;
  padding: 0 18px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 14px;
  min-width: 300px;
}

.brand strong {
  font-size: 20px;
}

#saveState {
  color: var(--muted);
  font-size: 12px;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

.mini-input {
  width: 110px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
}

.file-btn {
  display: inline-flex;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.file-btn input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  height: calc(100vh - 66px);
}

.sidebar {
  border-right: 1px solid var(--line);
  padding: 14px;
  overflow: auto;
  background: #f8fafc;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
}

.panel h2 {
  margin: 0 0 10px;
  font-size: 14px;
}

.input,
.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 9px;
  background: #fff;
  color: var(--ink);
}

.field {
  display: block;
  margin-top: 10px;
}

.field span {
  display: block;
  margin-bottom: 5px;
  color: #475467;
  font-size: 12px;
}

.field.compact {
  width: 118px;
  margin: 0;
}

.field.compact span {
  display: none;
}

.field.compact select {
  height: 34px;
  padding: 0 8px;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  color: #344054;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.stat {
  padding: 10px;
  border: 1px solid #e4e7ec;
  border-radius: 6px;
  background: #f9fafb;
}

.stat strong {
  display: block;
  font-size: 18px;
}

.stat span {
  color: var(--muted);
  font-size: 12px;
}

.queue-list {
  max-height: 320px;
  overflow: auto;
}

.queue-item {
  border: 1px solid #e4e7ec;
  border-radius: 6px;
  padding: 9px;
  margin-bottom: 8px;
  background: #fff;
}

.queue-item strong {
  display: block;
  font-size: 13px;
  margin-bottom: 4px;
}

.queue-item small {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
}

.queue-item button {
  width: 100%;
  height: 30px;
}

.workspace {
  min-width: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.stage-head {
  display: grid;
  grid-template-columns: repeat(5, 290px);
  gap: 70px;
  min-width: 1780px;
  padding: 14px 24px 10px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.stage-label {
  height: 34px;
  border-bottom: 4px solid #cbd5e1;
  color: #344054;
  font-weight: 700;
}

.tree-viewport {
  overflow: auto;
  flex: 1;
  position: relative;
}

.tree-canvas {
  position: relative;
  min-width: 1860px;
  min-height: 1600px;
  padding: 24px;
}

.edge-layer,
.node-layer {
  position: absolute;
  inset: 0;
}

.edge-layer {
  pointer-events: none;
  overflow: visible;
}

.edge {
  stroke: #98a2b3;
  stroke-width: 2;
  fill: none;
}

.edge.blocked {
  stroke: #f59e0b;
  stroke-dasharray: 6 6;
}

.task-node {
  position: absolute;
  width: 290px;
  min-height: 112px;
  border: 1px solid #d0d5dd;
  border-top-width: 5px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 2px 8px rgb(16 24 40 / 8%);
  padding: 10px 11px;
  cursor: grab;
}

.task-node:active {
  cursor: grabbing;
}

.task-node.selected {
  outline: 3px solid #bfdbfe;
}

.task-node .node-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
}

.task-node .id {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.task-node .priority {
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 11px;
  background: #f2f4f7;
}

.task-node h3 {
  margin: 0 0 6px;
  font-size: 15px;
  line-height: 1.25;
}

.task-node p {
  margin: 0 0 9px;
  color: #475467;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.node-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
}

.status-pill {
  border-radius: 999px;
  padding: 2px 8px;
  background: #f2f4f7;
  color: #344054;
}

.assignee {
  color: var(--muted);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-node[data-status="已认领"],
.task-node[data-status="进行中"] {
  background: #f8fbff;
}

.task-node[data-status="受阻"] {
  background: var(--amber-weak);
}

.task-node[data-status="已完成"] {
  background: var(--green-weak);
}

.task-node[data-status="暂缓"] {
  background: #f2f4f7;
  opacity: 0.75;
}

.task-node[data-branch="基础设施"] {
  border-top-color: var(--blue);
}

.task-node[data-branch="AI中台"] {
  border-top-color: var(--amber);
}

.task-node[data-branch="业务应用"] {
  border-top-color: var(--green);
}

.task-node[data-branch="组织优化"] {
  border-top-color: var(--violet);
}

.task-node[data-branch="支线/副业"] {
  border-top-color: var(--teal);
  border-style: dashed;
}

.drawer {
  position: fixed;
  right: 0;
  top: 66px;
  width: 520px;
  max-width: 90vw;
  height: calc(100vh - 66px);
  background: #fff;
  border-left: 1px solid var(--line);
  box-shadow: -12px 0 30px rgb(16 24 40 / 12%);
  transform: translateX(105%);
  transition: transform 160ms ease;
  z-index: 30;
  display: flex;
  flex-direction: column;
}

.drawer.open {
  transform: translateX(0);
}

.drawer-head {
  height: 56px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.task-form {
  overflow: auto;
  padding: 14px;
}

.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.drawer-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  padding-bottom: 16px;
  flex-wrap: wrap;
}
