html, body.architecture-page {
  height: 100%;
  margin: 0;
}

body.architecture-page {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
}

.arch-topbar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 22px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.arch-topbar-nav {
  display: flex;
  align-items: center;
  gap: 16px;
}

.arch-topbar-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.arch-back {
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #e2e8f0;
  border-radius: 6px;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.arch-back:hover {
  background: #cbd5e1;
  color: var(--accent-strong);
}

.arch-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.arch-title img {
  width: 30px;
  height: 30px;
}

.arch-title strong {
  display: block;
  font-size: 15px;
}

.arch-title span {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.arch-project-picker {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 600;
}

.arch-project-picker select {
  height: 36px;
  border-radius: 6px;
  border: 1px solid var(--line);
  padding: 0 10px;
  background: #fbfdff;
  color: var(--text);
  font-size: 13px;
  min-width: 220px;
}

.arch-connection {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.arch-canvas-wrap {
  flex: 1;
  position: relative;
  overflow: auto;
  padding: 32px;
}

.arch-empty {
  color: var(--muted);
  font-size: 14px;
  padding: 40px;
  text-align: center;
}

.arch-canvas {
  position: relative;
}

.diagram-edges {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
}

.diagram-edge-main {
  fill: none;
  stroke: #b9c6d1;
  stroke-width: 2;
}

.diagram-edge-child {
  fill: none;
  stroke: #c3cdd6;
  stroke-width: 1.5;
  stroke-dasharray: 4 4;
}

.diagram-node {
  position: absolute;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px;
  box-sizing: border-box;
  overflow: hidden;
}

.diagram-node.main {
  border-radius: 16px;
  border-width: 2px;
  gap: 6px;
}

.diagram-node.main .diagram-node-title {
  font-weight: 800;
  font-size: 14px;
  line-height: 1.2;
}

.diagram-node.main .diagram-node-path {
  font-size: 10.5px;
  color: var(--muted);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.diagram-role-badge {
  display: inline-flex;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--accent-strong);
}

.diagram-node.child {
  border: none;
  box-shadow: none;
  background: transparent;
  gap: 6px;
}

.diagram-node.child .diagram-node-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  color: #ffffff;
  box-shadow: var(--shadow);
  flex: none;
}

.diagram-node.child .diagram-node-title {
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.15;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.diagram-category-language { background: #2563eb; }
.diagram-category-runtime { background: #16a34a; }
.diagram-category-framework { background: #7c3aed; }
.diagram-category-database { background: #0f766e; }
.diagram-category-buildTool { background: #ea580c; }
.diagram-category-packageManager { background: #db2777; }
.diagram-category-infrastructure { background: #64748b; }

@media (max-width: 768px) {
  .arch-topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 12px 14px;
  }

  .arch-topbar-nav {
    justify-content: space-between;
    width: 100%;
  }

  .arch-topbar-controls {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: 8px;
  }

  .arch-project-picker {
    width: 100%;
  }

  .arch-project-picker select {
    flex: 1;
    width: 100%;
    min-width: 0;
  }

  .arch-connection {
    font-size: 11px;
    text-align: right;
  }

  .arch-canvas-wrap {
    padding: 16px;
  }
}
