:root {
  --bg: #f5f7fa;
  --panel: #ffffff;
  --line: #d9dee8;
  --text: #1e293b;
  --muted: #64748b;
  --blue: #1f6feb;
  --green: #2f855a;
  --amber: #b7791f;
  --red: #c53030;
  --ink: #263238;
  --shadow: 0 8px 24px rgba(31, 41, 55, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

button,
a {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 12px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
}

button:hover,
a:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.topbar h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
}

.topbar p,
.panel-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.topbar-actions,
.launch-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.topbar-actions a,
.launch-list a,
.module-actions a {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 10px;
  background: #fff;
  font-size: 13px;
}

.workspace {
  flex: 1;
  display: grid;
  grid-template-columns: 280px minmax(560px, 1fr) 340px;
  gap: 14px;
  padding: 14px;
  min-height: 0;
}

.sidebar,
.main-stage,
.detail-pane {
  min-width: 0;
}

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

.panel h2 {
  margin: 0 0 10px;
  font-size: 15px;
  line-height: 1.3;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 2px 9px;
  background: #e8f1ff;
  color: #1554b3;
  font-size: 12px;
  white-space: nowrap;
}

.badge.done {
  background: #e6f4ea;
  color: var(--green);
}

.badge.next,
.badge.building {
  background: #fff3cd;
  color: var(--amber);
}

.badge.blocked {
  background: #fee2e2;
  color: var(--red);
}

.phase-list,
.boundary-list,
.next-queue,
.module-detail,
.object-bus,
.graph-grid {
  display: grid;
  gap: 8px;
}

.phase-item,
.boundary-list div,
.queue-item,
.object-item,
.graph-item {
  padding: 10px;
  border: 1px solid #edf0f5;
  border-radius: 8px;
  background: #fbfcfe;
}

.phase-item span,
.boundary-list span,
.queue-item span,
.object-item span,
.graph-item span,
.module-detail span,
.module-card span,
.flow-node span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.phase-item strong,
.boundary-list strong,
.queue-item strong,
.object-item strong,
.graph-item strong,
.module-detail strong,
.module-card strong,
.flow-node strong {
  display: block;
  margin-top: 3px;
  font-size: 13px;
  line-height: 1.4;
}

.flow-track {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.flow-node {
  min-height: 112px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: 8px;
  background: #fbfcfe;
}

.flow-node.done {
  border-left-color: var(--green);
}

.flow-node.next {
  border-left-color: var(--amber);
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.module-card {
  min-height: 176px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.module-card:hover,
.module-card.active {
  border-color: var(--blue);
  box-shadow: 0 8px 20px rgba(31, 111, 235, 0.12);
}

.module-card p,
.module-detail p,
.object-item p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.module-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

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

.object-bus,
.graph-grid {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.object-item {
  border-left: 4px solid var(--ink);
}

.graph-item {
  border-left: 4px solid var(--amber);
}

.detail-card {
  min-height: 278px;
}

.module-detail .detail-row {
  padding: 9px 0;
  border-bottom: 1px solid #edf0f5;
}

.module-detail .detail-row:last-child {
  border-bottom: 0;
}

@media (max-width: 1220px) {
  .workspace {
    grid-template-columns: 260px 1fr;
  }

  .detail-pane {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
  }

  .detail-pane .panel {
    margin-bottom: 0;
  }

  .module-grid,
  .object-bus,
  .graph-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions {
    justify-content: flex-start;
  }

  .workspace,
  .detail-pane {
    grid-template-columns: 1fr;
  }

  .flow-track,
  .module-grid,
  .object-bus,
  .graph-grid {
    grid-template-columns: 1fr;
  }
}
